-
Notifications
You must be signed in to change notification settings - Fork 18
HTML Minification ? #12
Comments
Support for jade would be nice!! I think that's what you want ;) BTW this is a feature request and not an issue.. please move |
All feature requests are issues, not only problems, or bugs. Code before:
Code after:
With any other render optimizations, of course. |
ah ok, thought issues are only bugs here, thx mate. Then it would be nice to have support for all of them:
|
@faeb187 weird. heh |
I just want to warn, that occasionally HTML minification can change the meaning of a page! Specifically I experienced it when the browser was interpreting newlines as a gap, and the minifier removed those newlines (and indentation). Given certain CSS settings (I forget which property now),
is equivalent to:
But if you minify it to
then the resulting output is different! (You have lost the gap.) For that reason, we stopped using Jade's built-in minifier for production, and stuck with un-minified HTML, like we had in development mode. This is a rare issue, but it might trip people up (although if they use the minifier in both dev and prod mode, then they should be ok). |
One other concern, if you are minifying but not caching, then you might be making the network transfer faster, but slowing down the actual response! This depends on the size of your HTML, and the speed of your minifier (related to CPU power of course). If you are caching semi-static pages, then this only applies to the first request, so no problem. And if it is optional, then the dev can make the decision for themself. Just wanted to warn about that too. ;) |
Minifying template is a good idea because it can be safely cached :-) |
@joeytwiddle it could be several params, because there cases you may want to minify css inside cases like: <a property="value"></a> to <a property=value></a> or <i class="icon-x"></i> to <i class="icon-x" /> .... |
I really want to minify, because I make a lot of requests with pjax, and all the HTML comes with spacing... |
@marceloboeira Have you enabled gzip? According to those real world test results, gzip is really an effective way to reduce traffic. |
@breeswish yeap. but I guess html minification could help me even more. |
+1 |
+1 for html output minify |
|
Bleugh, tired of waiting. Found https://www.npmjs.com/package/express-minify-html It's not perfect, would love for regular express-minify to gain this ability... |
this is oooooooooooooold as hell. I haven't done JS since 2015. hahah a |
express-minify-html's last commit was in 2017 and now features a high severity vulnerability. Let's just add basic HTML minification to regular express-minify. |
Where would that be? e.g. no really.... citation is needed please. Refs: $ npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
added 6 packages from 41 contributors and audited 7 packages in 0.524s
found 0 vulnerabilities
$ npm audit
=== npm audit security report ===
found 0 vulnerabilities
in 7 scanned packages
|
I Guess it could be nice to minify html, with no cache of course.
The text was updated successfully, but these errors were encountered: