Why do many sites minify CSS and JavaScript but not HTML?

Josh Curren picture Josh Curren · Mar 1, 2010 · Viewed 18.8k times · Source

Possible Duplicate:
Why minify assets and not the markup?

I have seen a lot of sites using minified CSS and JavaScript to increase website response time but I have never seen any sites use minified HTML. Why would you not want your HTML to be minified?

Answer

Dominic Rodger picture Dominic Rodger · Mar 1, 2010

Because if you're doing things properly you're serving HTML gzipped anyway, so the low-hanging fruit of HTML minification - whitespace - isn't all that relevant. There aren't lots of easy targets (e.g. variable names) for minification in HTML, which are present in CSS and JavaScript. Much of the content of HTML is the actual content of the page, which probably can't be minified (and, as others have pointed out, will almost certainly vary more frequently than your CSS or JS).