In other words, this is what I would like to accomplish.
<script src="1.js" /> <script src="2.js" />
<script src="combined.js" />
I am looking for a commandline tool to concatenate 1.js and 2.js into combined.js. Then, a commandline tool (or maybe the same tool) to replace the references in the HTML file to this new file. Please tell me how I could accomplish this.
What I have tried so far:
I have been looking at grunt-usemin which looks good, but requires the build server to perform an
npm install on each build to get the dependencies, then run it. That takes too long and isn't a nice solution, because we build+deploy very frequently.
I know I could also add my
node_modules folder to git but this is also undesirable. It would be nice if grunt could run these modules installed globally but it is not the grunt way (unless I am mistaken, grunt wants everything installed locally).
Someone also suggested running grunt on the developer machines. Again, undesirable as we have transient VMs and this would break the development flow.
It would be nice if I could run grunt-usemin locally without grunt!
I ended up creating my own: https://npmjs.org/package/hashcat
npm install -g hashcat
@gustavohenke's recommendation was close but ultimately h5bp was proving to be too problematic for use on a build server. Ultimately creating this module did not take long and serves my needs for now. I will mark this as the answer until a better answer comes along in the future.
This recipe can be found in it's original form on Stack Over Flow.