Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I concatenate javascript files and replace the reference in my HTML?
    primarykey
    data
    text
    <p>As part of my build/CI process on TeamCity, I would like to specify a set of JavaScript files referenced in my HTML and combine them into one.</p> <p>In other words, this is what I would like to accomplish.</p> <p>Before:</p> <pre><code>&lt;script src="1.js" /&gt; &lt;script src="2.js" /&gt; </code></pre> <p>After</p> <pre><code>&lt;script src="combined.js" /&gt; </code></pre> <p>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. </p> <p><em>What I have tried so far:</em></p> <p>I have been looking at <a href="https://github.com/yeoman/grunt-usemin" rel="nofollow">grunt-usemin</a> which looks good, but requires the build server to perform an <code>npm install</code> 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. </p> <p>I know I could also add my <code>node_modules</code> 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). </p> <p>Someone also suggested running grunt on the developer machines. Again, undesirable as we have transient VMs and this would break the development flow. </p> <p>It would be nice if I could run grunt-usemin locally without grunt!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload