Wp-rocket: Get rid of Minify HTML option

Created on 26 May 2020  路  14Comments  路  Source: wp-media/wp-rocket

What are we proposing to do?

With this update we are hoping to remove the 芦聽Minify HTML聽禄 option from WP Rocket UI (File Optimization tab).

Why are we doing this?

GT Metrix has deprecated this recommandation as the effect on overall performance is very small :

https://gtmetrix.com/blog/recommendation-updates-http-2-changes-and-more/?fbclid=IwAR1ZQ2FUmlbazFScrVIAUG08MV5-yVXVXU4J36vubnvZ6MeclF43QwAla44

GT Metrix was the latest performance tool to recommend HTML minification. PageSpeed Insight and Pingdom Tools ignore this recommandation since a while.

Here a GT Metrix test comparaison:

With Minify HTML

https://gtmetrix.com/reports/wp-rocket.me/JUC11exR

  • Grade: 100 / 96

  • Loading time: 0.8s

  • Page Size: 956KB

Without Minify HTML

https://gtmetrix.com/reports/wp-rocket.me/Xv7fZ4DG

  • Grade: 100 / 96

  • Loading time: 0.8s

  • Page Size: 957KB

The loading time is exactly the same. Why? The page size only increased by 0.01KB...

How will we do this feature?

From version 3.7, all users will not have this option in WP Rocket UI and HTML minification won't be applied anymore.

Both existing and new users will have the same experience.

Development

inc/Plugin.php

  • Remove the minify_html_subscriber entry from the subscribers

inc/admin/upgrader.php

  • Remove the entry for minify_html in rocket_first_install()

  • Remove the checks for minify_html in rocket_new_upgrade()

inc/admin/ui/meta-boxes.php

  • Remove minify_html from the $fields in rocket_display_cache_options_meta_boxes() and rocket_save_metabox_options()

inc/admin/ui/notices.php

  • Remove the checks for minify_html in rocket_plugins_to_deactivate()

inc/3rd-party/hosting/wp-serveur.php

  • Deprecate the rocket_deactivate_inline_js_on_wp_serveur() function

inc/3rd-party/plugins/appbanner.php

  • Deprecate the rocket_deactivate_js_minifier_with_appbanner() function

  • Delete the file

  • Remove the require in inc/3rd-party.php

inc/3rd-party/plugins/autoptimize.php

  • Deprecate the rocket_maybe_deactivate_minify_html() function

  • Update rocket_activate_autoptimize() to remove the check for minify_html

  • Deprecate rocket_maybe_disable_minify_html()

inc/3rd-party/plugins/slider/revslider.php

  • Deprecate the rocket_deactivate_js_minifier_with_revslider() function

  • Delete the file

  • Remove the require in inc/3rd-party.php

inc/classes/subscriber/Optimization/class-minify-html-subscriber.php

  • Deprecate the class

inc/Engine/Beacon/Beacon.php

  • Remove minify_html from session_data()

inc/Engine/Admin/Deactivation/DeactivationIntent.php

  • Remove minify_html from activate_safe_mode()

inc/Engine/Admin/Settings/Page.php

  • Remove references to minify HTML option

inc/Engine/Admin/Settings/Settings.php

  • Remove references to minify_html in sanitize_callback()

inc/Engine/Optimization/ServiceProvider.php

  • Remove registering minify HTML subscriber in $provides and register()

inc/vendors/classes/class-minify-html.php

  • Deprecate the class

Risks

Since we are removing a feature, this should be low risk. The major concern is educating customers.

Testing

  • Update WP Rocket to 3.7.

  • The UI for "Minify HTML" is removed.

  • On front-end, the HTML shouldn't be minified

Documentation and Translations

epics 馃敟 file optimization documentation enhancement

Most helpful comment

@Camilo517 We won't have an option to just delete HTML comment. It won't speed up your website at all.

In average, on desktop, HTML minification will improve by only 7ms your loading time, which is insignificant. We prefer to be focused on improving existing and new features which could help to save seconds!

All 14 comments

@GeekPress Does that mean there will be a new option to remove comments from the html?

@Camilo517 We won't have an option to just delete HTML comment. It won't speed up your website at all.

In average, on desktop, HTML minification will improve by only 7ms your loading time, which is insignificant. We prefer to be focused on improving existing and new features which could help to save seconds!

You may want to advertise to users complaining that gzip also compresses whitespace, and whatnot--making this feature even more useless :) spread the word!

Why remove the feature, though? 7ms is better than nothing.
Even though it's not significant, keeping this feature doesn't cause any harm, right?

@AlessioGr I can understand your perspective. 7ms is better than 0. Keeping it might not cause any harm, but that's not always the case.

  • We are striving to make WP Rocket as user friendly as possible. Not everyone understands what all the features mean and reducing one or few options means they have fewer decisions to make.
  • Code is hard to maintain especially when we keep adding features. Each new feature has to be tested with existing features to make sure things do not break. We wish to spend this time on testing and creating features that creates a meaningful impact rather than save a few micro seconds.
  • Every feature we have needs support too. Minification of HTML causes rare issues and questions (back to point one).

Don't worry, we are planning on many features that will save seconds, not milliseconds. Thanks for your input!

I tested turn off Minify HTML on a site, it broke, I have to disable Combine JavaScript files too, which makes it slower.
I don't know why, but it seems Minify HTML fixed some accidentally.

I remember this was removed at least one other time before, and for those of us that still wanted it, we could at least add a line of code to _wp-config.php_ to get it back. Might that happen again, or is it really gone completely, for good?

I'm sure I'm preaching to the choir on this, but isn't the philosophy that _every little bit_ counts? Yes, it's only a fraction of a second faster, but on just _one loading_ of _one page_. If you have thousands, tens of thousands, hundreds of thousands, or even millions of visitors, this feature will have exponential value in terms of server resources.

I do understand that the greater good must be for the majority of users, who on average probably only have hundreds of visitors (and so it really will make no difference), but I thought I'd throw my $0.02 in just in case it manages to sway the matter at all.

Thanks

@bhadaway Thanks for taking the time to provide feedback. I understand your point of view, and it is hard to take away features.

I remember this was removed at least one other time before, and for those of us that still wanted it, we could at least add a line of code to wp-config.php to get it back. Might that happen again, or is it really gone completely, for good?

The entire code is removed from WP Rocket, so there is no filter or code that can bring it back. This was removed as part of making WP Rocket more efficient both for customers and developers. Minification of HTML consumes server time too. A million pages to minify (every 8 hours) is a lot of server resources that gives negligible returns.

Lesser code to maintain also means we can focus on innovative new features that will give real returns. Don't worry, when we take away 0.01second of performance, we will add 10X or more performance gains with other new features.

It's clear that this feature is most likely gone for good, so I only wish to add the following for the sake of concluding the discussion. When you say needs to re-minify every 8 hours, I assume you mean if the user has set the cache to automatically clear every 8 hours, not if it's set to never clear automatically?

Also, I felt minifying all the HTML into one line had other value like hiding formatting, cleaning up the code/comments, etc. I simply preferred it. Again, I understand that I'm an outlier and a good 95% of users probably weren't even aware of the feature or its results anyway.

In any case, WP Rocket is an essential tool for any website built with WordPress. Thanks for all the hard work and I'm sure I'll continue to be a user no matter how the project evolves in the future.

Not sure why you are taking the 7ms as the "definition". Maybe in a very short html, improvement its just 7ms. But in a 2400 lines html, were 50% are blank spaces and new lines, that will be a little bit more than 7ms. As html grows, minifying html becomes exponentially more useful. Why don't leave it as an option to enable/disable? if it cause problems just disable it.

@natzar

But in a 2400 lines html, were 50% are blank spaces and new lines, that will be a little bit more than 7ms

If you are using gzip or Brotli, that will remove the whitespaces anyway. The difference wouldn't make much sense in terms of overall performance.

Why don't leave it as an option to enable/disable? if it cause problems just disable it.

Not every user is happy to disable an option. They feel like they are not getting their full value out of it. We need to spend time and energy to investigate and figure out what the issue is.

The main reason to remove is that the feature didn't add any considerable value. Most hosts use gzip.

Thanks, didnt know brotli did exactly that. Interesting what you comment about perception of value on features.

Was this page helpful?
0 / 5 - 0 ratings