I'm looking for very simple template script for building JS files. It should do only one thing: include one file to another.
Template (main.js)
/*> script.js */
var style = "/*> style.css */";
script.js
var my_script;
style.css
html, body {margin:0; padding:0}
.my-style {background: #fffacc}
Output
var my_script;
var style = "html, body {margin:0; padding:0}\
.my-style {background: #fffacc}";
I've made cat main.js | sed -e 's!/\*> \(.*\) \*/!cat \1!g'
. Output from it:
cat script.js
var style = "cat style.css";
How make cat \1
actually work?
I will use it for building UserJS (Greasemonkey scripts). I've few JS and CSS files in my repository. I would like to keep them separate from each other. But result script must be only one, so I need merge all JS and CSS files to it.
I can use sed, awk, perl or ruby.
Finally, I've made js-preprocessor. Thanks guys!