XML : How to minify php page XHTML output while keeping it XML compatible

After a frustrating try of several existing functions for the task, e.g. PhpWee

  PHPWee\Minify::html($buffer);    

And finding that HTML minifiers can be a real nightmare when combined with XHTML input, I'm looking for a viabke solution that:

  • does not ruins self-closing nodes
  • does not remove // style comments from inline js/css
  • does not put the doctype before the
  • generally keeps XHTML being XML

(and yes you may deliver HTML5 as application/xml, this is about current technology not ancient technology)

Overall goal: complying with "google page speed insight"'s wishes for minified HTML.

No comments:

Post a Comment