I have a few hand-crafted web pages. When deploying them I would like to run them through a tool so that new smaller HTML files are created, with extraneous whitespace taken out, etc.
We already use YUICompressor for our Javascript and our CSS, and we tend to follow all of the techniques described by the Yahoo performance team.
Is there a good, free tool that does this? I prefer tools that would fit into our deployment process similarly to YUICompressor.
HTML Tidy does the job.
I use the following on one document that I generate (a rather large one). This saved me about 10% on the post-gzip size.
-c— Replace surplus presentational tags and attributes-omit— Drop optional end tags-ashtml— use HTML rather than XHTML (HTML is leaner and XHTML provides no benefits for most use cases)-utf8— So we don’t have to use entities for characters outside the character set (entities are more bytes)--doctype strict— use Strict (again, leaner)--drop-proprietary-attributes yes— get rid of proprietary junk--output-bom no— BOMs cause issues in some clients--wrap 0— Have very long lines