Hacker News new | past | comments | ask | show | jobs | submit login

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);



Hope you don't have any <textarea> or <pre> tags on the page.


I don't, but unless you fill them full of whitespace and nothing else, they won't match.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: