title: Compacting/minifying dynamic html
body: <p>I am using django templating, and for readability I have html that looks similar to the following:</p>
  
  <pre><code>{% if some_variable %}
      text
  {% else %}
      nothing exists here
  {% endif %}
  
  {% for item in set %}
      {% if forloop.first %}
  ...etc...
  </code></pre>
  
  <p>It converts to the following html at runtime, which includes tons of whitespace and returns:</p>
  
  <pre><code>text
  
  &lt;div&gt;
  
    &lt;li
  
          class='some_class
  
      &gt;
  
      some text
  
     &lt;/li&gt;
  
  &lt;/div&gt;
  
  etc...
  </code></pre>
  
  <p>Some pages even run to ~3,000 lines of html when viewing the page source.</p>
  
  <p>Is there a tool to compress this html at runtime? What about a tool to remove extra line breaks?</p>