Skip to content
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

Get rid of Minify HTML option #2682

Closed
GeekPress opened this issue May 26, 2020 · 15 comments · Fixed by #2813
Closed

Get rid of Minify HTML option #2682

GeekPress opened this issue May 26, 2020 · 15 comments · Fixed by #2813
Labels
epics 🔥 module: file optimization needs: documentation Issues which need to create or update a documentation type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@GeekPress
Copy link
Contributor

GeekPress commented May 26, 2020

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

@GeekPress GeekPress added epics 🔥 module: file optimization type: enhancement Improvements that slightly enhance existing functionality and are fast to implement labels May 26, 2020
@GeekPress
Copy link
Contributor Author

GeekPress commented May 26, 2020

@GeekPress GeekPress added this to the 3.7 milestone May 26, 2020
@webtrainingwheels webtrainingwheels added the needs: documentation Issues which need to create or update a documentation label May 26, 2020
@Camilo517
Copy link
Contributor

Camilo517 commented May 28, 2020

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

@GeekPress
Copy link
Contributor Author

GeekPress commented May 29, 2020

@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!

@Tabrisrp Tabrisrp added the GROOMING IN PROGRESS Use this label when the issue is currently being groomed. label Jun 5, 2020
@Tabrisrp Tabrisrp removed GROOMING IN PROGRESS Use this label when the issue is currently being groomed. needs: grooming labels Jun 5, 2020
crystinutzaa added a commit that referenced this issue Jun 23, 2020
Sub-task for epic #2682 

### inc/Plugin.php ✔️ 
- Remove the minify_html_subscriber entry from the subscribers

### inc/classes/subscriber/Optimization/class-minify-html-subscriber.php ✔️ 
- Deprecate the class

### inc/Engine/Optimization/ServiceProvider.php ✔️ 
- Remove registering minify HTML subscriber in $provides and register()

### inc/vendors/classes/class-minify-html.php ✔️ 
- Deprecate the class
@hellofromtonya hellofromtonya linked a pull request Jun 23, 2020 that will close this issue
@Tabrisrp Tabrisrp mentioned this issue Aug 11, 2020
24 tasks
@sybrew
Copy link
Contributor

sybrew commented Sep 3, 2020

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

@AlessioGr
Copy link

AlessioGr commented Sep 3, 2020

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?

@arunbasillal
Copy link
Contributor

arunbasillal commented Sep 3, 2020

@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!

@homu9
Copy link

homu9 commented Sep 4, 2020

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.

@bhadaway
Copy link

bhadaway commented Sep 20, 2020

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

@arunbasillal
Copy link
Contributor

arunbasillal commented Sep 21, 2020

@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.

@bhadaway
Copy link

bhadaway commented Sep 21, 2020

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.

@Camilo517
Copy link
Contributor

Camilo517 commented Sep 21, 2020

@bhadaway
https://es.wordpress.org/plugins/asta-html-minifier/

@natzar
Copy link

natzar commented Jan 14, 2021

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.

@arunbasillal
Copy link
Contributor

arunbasillal commented Jan 14, 2021

@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.

@natzar
Copy link

natzar commented Jan 14, 2021

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

@ebstudo
Copy link

ebstudo commented Sep 26, 2021

(translated). I want to join the conversation just now, because I installed WP Rocket recently and I find a regular plugin like other cache plugins. WP Rocket appears to be quite "heavy" on the WordPress backend, but it improves significantly for the frontend.
For those who have used other cache plugins, notice that information is still missing from the WP Rocket panel. For example: total cached pages and information about preloading files to cache. (is the tip)

WP Rocket is better for mobile devices, if you test it on PageSpeed ​​Insights you can see performance improvements.

And now talking about minify HTML: it seems that developers are worried about people who don't want minify HTML and ignore those who want minify HTML. I see a full plugin when it has all the options to choose from. This is a fact!
I've never seen anyone complain about an over-resourced plugin. If anyone knows this please mention it here!
Minify HTML is important, yes. Does it reduce only 7ms? But this is essential, for the tip of the iceberg, that is: 7ms here, 7ms there and in the end the site is loading faster.

The point is: WP Rocket developers stick only to GT Metrix, but all of their customers test PageSpeed ​​Insights, including me.

Virtually all popular WP site caching and optimization plugins have the minify HTML option. Is only WP Rocket right? I see the opposite!

If WP Rocket wants to do a reputation analysis, make a free WordPress version available. I don't mean the plugin is bad, but it would be a 3 star plugin. I repeat, the plugin is not bad, on the contrary WP Rocket is great, but only because the information is complex and the resources incomplete, at least for most.

@wp-media wp-media locked and limited conversation to collaborators Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
epics 🔥 module: file optimization needs: documentation Issues which need to create or update a documentation type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.