Compress HTML Source [Deleted]

This works for me! :) Well, at least according to Google Pagespeed Insights which now says my HTML is minified.

(I'm running PHP 5.5.12.)

@Eagle, you might want to update the screenshot on the add-on Overview page here, since the HTML compression option is now on the Performance options page.
 
With CloudFlare, my HTML is already considerably minified (PageSpeed only reports a few hundreds bytes that can still be minified - thus not really anything to be concerned with) . But I still need an add-on that can considerably minify inline JS. Preferably only removing the indenting. I've tried utilizing Minify 2.1.7, but it removes some necessary white spaces on the actual HTML. Although their inline JS minification were pretty good and nothing broke with UI.X. I suppose I'll try to somehow use only their inline JS minification.

So far, I've got 98% on PageSpeed score (may drop to 96 when there are many different avatars displaying on forum list due to how avatars have query string on their URLs).

EDIT: Managed to create an add-on which utilizes Minify 2.1.7 library to only minify inline JS and CSS on HTML outputs by using 3 files from its library (edited one of it). When combined with CloudFlare's HTML compression, it's basically nearly fully minified and no errors, even on UI.X. It's live on my forums (on signature) if you want to see the result. Just visit any of its page and see the source code.
 
Last edited:
Ouch. I have found that the feature somehow causes certain attached images to not display. It's very strange, and mostly only 1 user is affected, but I can basically turn the problem on and off by turning on an off the Compress HTML Source option.

Here are a couple of images that didn't display:
white aubergines 1.webp

persontwo.gif
 
Last edited:
I'm running PHP 5.6.11 and its working fine for me.
Production environments should be using E_DEPRECATED within PHP error_reporting. I guess you're not, and thus deprecated functionality usage is not being reported to you.
PHP 7 has completely dropped support for preg_replace(), and it's usage has produced deprecated errors since PHP 5.5 - it shouldn't be used in any code for the last couple of years.

FYI, The “\e” modifier on the preg_replace() function was deprecated due to severe security implications. So using this add-on in it's current revision on a production environment is seriously not a very good idea.
 
It has something to do with the fact that it currently runs on every output, regardless of whether the output is html or not. Yes, including attachments. It also hits json output (breaks some ajax respond on your Admin CP).
On my add-on I've made so that it will only run on html to avoid that issue though.
 
Anyone done a real performance report on this? These types of plugins usually require enough processing to negate the reduced file size.
 
How did you defer all the XF JS?
No, I didn't. I merely fixed anything else that I could fix back then: Latest Performance Report for: https://forums.endlesshorizon.net/ | GTmetrix
Though if you've noticed, for some reason it didn't report query strings on avatar.
Thus, second check: Latest Performance Report for: https://forums.endlesshorizon.net/ | GTmetrix
Now it ended up reporting query strings on avatars and I ended up with 96%.

Anyone done a real performance report on this? These types of plugins usually require enough processing to negate the reduced file size.
Well, my forums isn't very crowded, but I've got similar add-on installed. Though It'll only minify inline JS and CSS on HTML outputs, so that CloudFlare can handle the rest of it (their HTML compression won't minify inline JS and CSS on HTML outputs). So far I can say that there's no pressure yet. Perhaps because I split the tasks as well.
 
Just to confirm that the most recent update (1.0.2) seems to have fixed the broken images problem.
Anyone done a real performance report on this? These types of plugins usually require enough processing to negate the reduced file size.
No, but happy to try this if you tell me how. Not that I have all that many users or anything.
 
Thanks for this mod Eagle!
I've installed the addon and I've selected the option to compress the html
but I can't see any improvements in my GTmetrix report:
Screen shot 2015-07-27 at 3.31.51 PM.webp
With or without addon I have the same numbers.
I also would like to improve this without break anything:
lol.webp
Appreciate some help, Thank you!
 
Last edited:
@rafass This add-on is supposed to minify HTML only without touching your inline JS. If you don't have any improvements at all with your score, I'd assume that one way or another your site was already minified? Perhaps if you're behind a CDN like CloudFlare and have used their HTML compression. Also, mind linking me to your GMetrix result? I'm quite curious with your YSlow reports. 98% is pretty high for YSlow. Even I only got 92% despite the fact that I've got 98% on PageSpeed.
 
Hello BobbyWibowo, I'm using CloudFlare but I have the HTML compression dissabled:
Screen shot 2015-07-27 at 5.02.07 PM.webp
with or without this addon my score is always same. 95 - 98
Screen shot 2015-07-27 at 5.11.37 PM.webp
I'll send you my report via pm cause my board is still under construction. ;)
 
@BobbyWibowo I'd be interested to learn how you are deferring your javascript as that seems to be the biggest reason for me getting a B instead of an A
 
@Rob I borrowed the deferrer function from this add-on: https://xenforo.com/community/resources/defer-js.2972/ and added it into my own personal add-on. Although I didn't change anything on the function, so it did whatever it was designed to. I've also been using UI.X-based theme (Antiquark) and I hadn't blacklisted anything but IE conditionals. All of my GTMetrix reports (set it to autocheck daily) reported that there were no issues with JavaScript deferring, so I believe it worked just well. I've also checked the website's source code to make sure that the <script> tags were correctly moved before </body> tag, and they did.
I've seen your replies about having issues with that add-on. To be honest, I'm clueless as to why you had those issues. Mind linking me to your recent GTMetrix report when you had that add-on enabled?
 
I have error with Resource Manager. small files is not Problem if i make Download. With big files over 50MB its rar file error.

I hope of help.
 
Top Bottom