Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

does anyone know of a way to get nginx (or any other method) to minify html output on the fly? It seems straightforward to me and can shave a few kb off and help speed up the site.

share|improve this question
2  
I'm not sure of an extension that has this capability, but, is it worth it? There will be a CPU impact on each request, it means your website will need more CPU as your load increases. I assume you're already using the gzip extension to compress the text before you send it, so, all whitespace will be removed as part of that process. You can also pre-gz your files, that will save CPU time on each request. –  Andrew Taylor Jan 14 '11 at 13:42
    
@AndrewTaylor, so that's why you'd better cache it afterwards. –  poige May 2 '12 at 14:35

1 Answer 1

My recommendation: forget minify and use the gzip module. It will work better and accomplish the same goal. But, as of course, you can do it. There's a 3rd party module named strip, especially for this topic.

share|improve this answer
1  
Good find. Doesn't look production-ready, though, so I second your recommendation of using gzip instead - saves much more than minifying the HTML. –  pjmorse May 2 '12 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.