News for hackers. Stuff that matters.
Re:Ask HN: Why do we minify JavaScript, yet not HTML? by salehenrahman on Sunday December 02, 2012 @04:16PM (#4862535)
I don't know about static sites. I would imagine to be very beneficial, in terms of bandwidth, to minify HTML.

But I once worked on a Facebook-like SaaS, and minifying HTML had huge performance hit on the back-end, since we used templates, not a proprocessor language such as Jade or HAML.

Re:Ask HN: Why do we minify JavaScript, yet not HTML? by TazeTSchnitzel on Sunday December 02, 2012 @04:18PM (#4862546)
Couldn't whitespace-stripping be done as a function of the templating language? I suppose spitting it out verbatim is cheaper, though.

EDIT: Wait, isn't that something the template compiler could do?

Re:Ask HN: Why do we minify JavaScript, yet not HTML? by salehenrahman on Sunday December 02, 2012 @04:21PM (#4862563)
Not sure. We simply used a templating engine. Either a) we didn't take the time to read the documentation properly to find out if there is an efficient minifier, or b) there isn't an efficient templating engine that minifies.

I'm betting big on using preprocessor languages, such as HAML, or Jade.

Re:Ask HN: Why do we minify JavaScript, yet not HTML? by mistercow on Sunday December 02, 2012 @05:31PM (#4862835)
Yeah, it seems like the correct order of operations would be to minify the template itself (when compiling it), which would eliminate any overhead.
Re:Ask HN: Why do we minify JavaScript, yet not HTML? by krapp on Sunday December 02, 2012 @05:39PM (#4862865)
Twig has the spaceless tag to remove whitespace from its templates, using that and its caching option might be basically what you're describing.