News for hackers. Stuff that matters.
Re:Ask HN: Why do we minify JavaScript, yet not HTML? by maratd on Sunday December 02, 2012 @04:55PM (#4862679)
It's pretty simple. Use a regex to eliminate whitespace and then gzip. Be sure to set the proper headers if you gzip.

I eliminate whitespace with the following PHP code:

    preg_replace(['/\t+/', '/>\s+</'], [' ', '><'], $html);
Re:Ask HN: Why do we minify JavaScript, yet not HTML? by cheald on Sunday December 02, 2012 @06:41PM (#4863126)
Hope you don't have any <textarea> or <pre> tags on the page.
Re:Ask HN: Why do we minify JavaScript, yet not HTML? by maratd on Sunday December 02, 2012 @10:16PM (#4863733)
I don't, but unless you fill them full of whitespace and nothing else, they won't match.