title: Compressing JS and CSS in Static HTML Files
body: <p>The output from <a href="http://sphinx.pocoo.org/" rel="noreferrer">Sphinx</a>, the python documentation generator, results in a large number of HTML files. Each one has a header with a large number of JavaScript and CSS includes:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" /&gt;
  &lt;link rel="stylesheet" href="../_static/pygments.css" type="text/css" /&gt;
  &lt;script type="text/javascript" src="../_static/jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="../_static/underscore.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="../_static/doctools.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="../_static/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="../_static/custom.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="../_static/colorbox/colorbox.css" /&gt;
  &lt;script type="text/javascript" src="../_static/colorbox/jquery.colorbox-min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Most of these are minified individually, but this is still suboptimal because it requires separate requests to the webserver when the client's cache is empty. Is there a tool like YUI Compressor or the Closure Compiler that will take HTML files as input, compress all of the individual externally-linked scripts, and then rewrite the output? This would be similar to what <a href="https://github.com/jezdez/django_compressor" rel="noreferrer">django_compressor</a> does.</p>