title: How to minify Symfony / Twig generated HTML code to satisfy Google PageSpeed Insight?
body: <p>When testing my <code>Symfony 2.8</code> based webpage with Google PageSpeed Insights I am getting warned, that the HTML code is not minified. </p>
  
  <p>This is true, while <code>Assetic</code> takes care of minifying all <code>CSS</code> files and <code>JS</code> scripts, the HTML code itself is quite dirty. </p>
  
  <p>Google recommends to use <a href="https://github.com/kangax/html-minifier" rel="noreferrer">HTML Minifier</a>, but since this a JavaScript tools it cannot be used as <code>Twig</code> extension, filter, etc., can it?</p>
  
  <p>The <code>Twig</code> docu of the <code>spaceless</code> tag makes clear, that this tag is not meant to minify HTML and furthmore:</p>
  
  <blockquote>
    <p>If you want to create a tag that actually removes all extra whitespace
    in an HTML string, be warned that this is not as easy as it seems to
    be (think of textarea or pre tags for instance). Using a third-party
    library like <strong>Tidy</strong> is probably a better idea.</p>
  </blockquote>
  
  <p>But again I don't see how <code>Tidy</code> could be integrated into the <code>Twig</code> templates, etc.</p>
  
  <p>So, what is the best way, to create minified HTML output with <code>Symfony</code> and <code>Twig</code>?</p>