HTML code optimization

  • Remove HTML comments
  • Remove/collapse whitespace
  • Remove optional closing tags (<p>foo</p> → <p>foo)
  • Remove quotes around attribute values, when allowed (<p class=foo> → <p class=foo>)
  • Remove optional values from boolean attributes (<option selected=selected> → <option selected>)
  • Munge inline styles, inline scripts and event attributes (if it’s not possible to remove them)
  • Munge classes and ids (needs to be in sync with scripts and style declarations)
  • Strip scheme names off of URLs (http://example.com → //example.com)