Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Experimenting with html minifier (perfectionkills.com)
19 points by pan69 on June 25, 2010 | hide | past | favorite | 9 comments


If you look at the difference in gzipped size, there is not so much difference. Is it all really worth it? The way gzip works means that a repetitive sequence of newlines and tabs will likely be only one char in the final output.


So this minimizer looks like premature optimization.


One of the things I've thought would be interesting to try, would be if you could reduce class and id names to 1 or 2 character strings a la javascript minifiers. You'd have to do globally across all html files, and linked css and js files, so it would be a bit challenging.


But aren't class and id names part of the (extended) user interface? Users are expected to be able to write their own CSS spreadsheets for your site.


Good point. Though they still could, right? As long as the class/id names were always "minified" to the same one or two letters.


That would be the minimum. Meaningful names would be even better, though.


...minifying XHTML documents (given that they’re actually served to clients properly, with “application/xhtml+xml”) doesn’t reduce size as much as if they were HTML.

I don't understand. Why can't the size of XHTML documents be reduced as much as HTML ones? And why would the MIME type matter?


HTML is more liberal about missing close tags, so minifying HTML should include removing those tags when the page is pushed to the browser.


Also for attributes. One of his first code examples shows this.

<input disabled="disabled">

to

<input disabled>




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

Search: