title: Automatic cache-busting for static builds that works well with npm run?
body: <p>I use <code>npm</code> as my build tool, by populating the <a href="https://docs.npmjs.com/misc/scripts" rel="nofollow"><code>scripts</code> field</a> with various commands for the tasks I need. I’m satisfied with the setup, except for one small detail: when building for production, I’d like for references to CSS files in <code>&lt;link&gt;</code> tags and references to JS files in <code>&lt;script&gt;</code> tags to be updated for cache busting (i.e. to be modified by appending <code>?random_string</code> to the file names, or similar).</p>
  
  <p>I’m using <a href="http://jade-lang.com/" rel="nofollow"><code>jade</code></a>, in case there’s a way to do it that way that I missed.</p>
  
  <p>I don’t mind if the solution busts every file, even if they weren’t changed since the last build. What I care is that it does not require me to add complex code to the website itself (like a function with this as its sole purpose); it should preferably be an external command.</p>
  
  <p>So far, I haven’t been able to find an acceptable solution. I’m almost about to resort to a regex, but would really rather have a more robust solution.</p>