title: Javascript minification automatization
body: <p>I have a website, that uses a lot of jquery/javascript. Now, at the index page I have about 10 javascript files included in the head:</p>
  
  <pre><code>&lt;head&gt;
  &lt;script src="/js/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_1.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_2.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_3.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_1.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_2.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_3.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_4.js"&gt;&lt;/script&gt;
  &lt;!-- ...and so on --&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Since visitor count grows bigger, I am starting to think about performance of all of this. I have read, that it is good idea, to minify all javascript files and gather them together in one, so a browser must make only one HTTP request. I did so. Now I have <code>everything.js</code> file containing all javascript, including jquery, plugins and my custom scripts.</p>
  
  <pre><code>&lt;head&gt;
  &lt;!--
  &lt;script src="/js/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_1.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_2.js"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery_plugin_3.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_1.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_2.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_3.js"&gt;&lt;/script&gt;
  &lt;script src="/js/my_scripts_4.js"&gt;&lt;/script&gt;
  ...
  --&gt;
  &lt;script src="/js/everything.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>The fun starts, when I need to make changes to one of the files. Every time, to check if my changes are working as expected, I need to compress the file and update <code>everything.js</code> or uncomment all the old code. With this kind of work-flow it is too easy to forget something and make a mistake.</p>
  
  <p><strong>Question:</strong> is there an automated thing that can take this headache away? Something, that would allow me to edit my separate files as I used to, and would minify and pull together everything when I'm ready to test my changes?</p>
  
  <p>I'm using PHP5 and SVN </p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>Thank you for your help, everybody, I found my solution:
  I will put a <code>post-commit</code> hook in my SVN repo that will take all my <code>.js</code> files, put them together and minify them using YUI compressor. Then, in my script I will fork javascript includes, so that in development environment the site will include separate javascript files, but in production the combined and minified file will be included.  </p>