Forums / Developer / How to minify html / Comment65771

Author Topic

Marko Žmak

Wednesday 09 February 2011 2:06:53 pm

Comment65771

I accidentally just found an interesting tool, mod_pagespeed:

  • http://code.google.com/speed/page-speed/docs/module.html

it has a filter that cleans up whitespaces:

  • http://code.google.com/speed/page-speed/docs/filter-whitespace-collapse.html

It preserves whitespaces in <script> and <pre>, and since it's an apache module I think it should work faster than a PHP output filter. And it also has some other interesting filters.

I'll probably give it a try...

For an interesting detail, note the chapter "Risks" on the whitespace filter page. I don't believe that any HTML minifier will honnor the "white-space: pre" CSS directive.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth