-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minify HTML #27
base: develop
Are you sure you want to change the base?
Minify HTML #27
Conversation
Merge branch 'develop' * develop: Bump version for 1.2.0-pl Change skipIfTagsRemain and skipBinaryContentTypes default to true Only cache published Resources Bump version for 1.2.0-dev Add ability to limit caching by ContentType id's Add ability to limit caching by Resource mime-type Add skipBinaryContentTypes for skipping Resources with binary Content
Merge branch 'develop' * develop: Bump version for 1.3.0-pl Add regenerate property for replacing static files vs. removing Add cacheTV property for forcing caching by TVs Fix resolver for PluginEvents
it looks like maybe I should have branched from develop or submitted the PR to master. My bad let me know if you want me to redo it. |
phpwee isn't without issues either so I'm all ears for another approach to minifying the HTML searchturbine/phpwee-php-minifier#14 |
Both min and phpwee give me issues related to this phpwee-php-minifier/issues/12 on and . I get away with it by adding margin through css. Untested and total curve ball approach but what about utilising Cloudflare? If you route traffic through their servers you can set it to minify css/js/html on the fly. |
@chrisdempsey CloudFlare sounds nice and I might enable it but I'm trying to determine how to get this to work "manually". The reason I went with phpwee over min is AFAIK min does weird stuff like combine all your CSS files into one and stuff like that. I don't want it trying to be too clever, just to minify the HTML itself. The funny thing is once I enabled statcache even without telling statcache to minify the HTML Google PageSpeed Insights decided to see the HTML as minified even though it isn't. Part of it is (the inline CSS) so maybe that was enough to trick it... |
@jpdevries As far as I know Min only combines files into one if you specifically configure it. I use the group feature to develop using readable code and let Min take care of combining/minifying on the fly without any further input from me. No need to worry about manually running Grunt tasks or similar after every change. If you check the source on my website you'll see lines like You can also use the url rewrite engine on your web server to automatically route css or js requests through Min. I find this helpful for the less skilled people hosting on my server, especially for the likes of Wordpress themes that often ship with full fat css/js. Not as efficient as combining the files but makes a difference. I know what you mean about not wanting to complicate things by adding Cloudflare as another layer. It could introduce issues if you need to track the source of a problem, only one account has access to clear the cache so another developer may not see changes they commit immediately. And you can't do anything if it makes a mistake with the minification. Probably also needs an entry in the privacy statement as requests are routed through a third party. It was the only other html minification option that came to mind though. On the plus side it does take a load off your own server, adds content distribution, offers a basic firewall (eg. block traffic from China that's trying to post spam in a forum) and offers an Always Online feature to serve your cached site if the source server doesn't respond. And if nothing else it's worth it just for the Nameservers. Odd that Pagespeed stopped throwing the Minify HTML recommendation when the request was served from statcache. As a side note, I remembered one of the other issues I had with Min and the HTML minification. The TinyMCE editor doesn't like empty cells. It adds a non breaking space which tripped up Min. The page ended up displaying question marks in the empty cells. Typically that would indicate a content encoding error but not so sure in this case so I added content to the empty cells n/a for a quick fix. |
Closes #26
I used phpwee because I think Mr Clay's tool because is overly opinionated.
Summary
Adds a
minifyHTML
option which defaults to false thatLook Mom. It's minified! 🎉