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

Asset Cleanup inline CSS/JavaScript features prevent the application of some of WP Rocket's automatic compatibilities #5268

Open
4 tasks
vmanthos opened this issue Jul 22, 2022 · 6 comments · Fixed by #6022
Assignees
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: remove unused css priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement

Comments

@vmanthos
Copy link
Contributor

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version ✅3.11.4.2
  • Used the search feature to ensure that the bug hasn’t been reported before ✅

Describe the bug

Asset Cleanup has the following two features:

  • Inline CSS files
  • Inline JavaScript files

When they are enabled, the content of the files is added inline, and the <script> and <link> elements are removed.

WP Rocket's compatibility with third parties quite often depends on excluding specific files, e.g. Delay JavaScript Execution exclusions for WooCommerce's product gallery:
the product gallery image:

'/jquery-?[0-9.]*(.min|.slim|.slim.min)?.js',
'/woocommerce/assets/js/zoom/jquery.zoom(.min)?.js',
'/woocommerce/assets/js/photoswipe/',
'/woocommerce/assets/js/flexslider/jquery.flexslider(.min)?.js',
'/woocommerce/assets/js/frontend/single-product(.min)?.js',

When the two features are enabled, we won't be excluding the files as those aren't there. Exclusions will still have to be applied, but this time by picking keywords from the content of the files and doing it by hand, i.e. our automatic compatibilities will not take place.

The same goes for all of these features:

  • Minify/Combine CSS files
  • Minify/Combine JavaScript files
  • Load JavaScript deferred
  • Delay JavaScript Execution
  • Remove Unused CSS - we use both CSS/JavaScript files as triggers to automatically safelist selectors

To Reproduce

Steps to reproduce the behavior:

  1. Install Asset Cleanup on a WooCommerce site.
  2. Enable the Inline JavaScript feature (Optimize JavaScript tab).
  3. Enable Delay JavaScript Execution.
  4. Visit a product page that has a gallery.
  5. The images will only be displayed after interaction with the page, i.e. the automatic compatibility won't be applied.

Expected behavior

Our compatibilities should be available to users of both plugins. I

Additional context

I checked Asset Cleanup but I didn't find filters to disable these two features. They have compatibility with us on their side, e.g. disabling their CSS minification when WP Rocket's is enabled.

@piotrbak will reach out to the dev to discuss this.

Ticket: https://secure.helpscout.net/conversation/1943489138/354652?folderId=273766

Backlog Grooming (for WP Media dev team use only)

  • Reproduce the problem
  • Identify the root cause
  • Scope a solution
  • Estimate the effort
@piotrbak piotrbak added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement 3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting priority: medium Issues which are important, but no one will go out of business. module: remove unused css labels Jul 22, 2022
@piotrbak
Copy link
Contributor

piotrbak commented Jun 22, 2023

Acceptance Criteria:

  1. We'll make Asset Cleanup and Asset Cleanup Pro not compatible with WP Rocket
  2. Equivalent message should be displayed when both plugins are active:
    image
  3. Dev Team: the confirmation of the fix should be presented using video

@piotrbak
Copy link
Contributor

It'll also fix the following issue:
#4480

@piotrbak piotrbak added the needs: documentation Issues which need to create or update a documentation label Jun 22, 2023
@Tabrisrp
Copy link
Contributor

Tabrisrp commented Jun 22, 2023

Scope a solution ✅

In inc/admin/ui/notices.php

Function rocket_plugins_to_deactivate()

  • Add Assets cleanup to the plugins array, using this key value pair:
  • 'wp-asset-clean-up' => 'wp-asset-clean-up/wpacu.php'

Estimate the effort ✅

Effort [XS]

@piotrbak Do we have the folder and main file names for the pro version?

@Tabrisrp Tabrisrp added effort: [XS] < 1 day of estimated development time and removed needs: grooming labels Jun 22, 2023
@mostafa-hisham mostafa-hisham self-assigned this Jul 4, 2023
@piotrbak piotrbak added this to the 3.14.2 milestone Jul 5, 2023
@piotrbak piotrbak reopened this Jul 19, 2023
@piotrbak
Copy link
Contributor

We'll need to revert this PR and update acceptance criteria as soon as we get what's needed to have a better compatibility with
Asset Cleanup.

@piotrbak piotrbak modified the milestones: 3.14.2, 3.14.2.1 Jul 19, 2023
@piotrbak piotrbak removed the effort: [XS] < 1 day of estimated development time label Jul 19, 2023
@seomarketingads
Copy link

you should notified the plugin team before two weeks from this decisions so they have the time to comply, better than forcing us to deactivate then activate

@piotrbak piotrbak removed needs: documentation Issues which need to create or update a documentation noQA labels Jul 25, 2023
@gabelivan
Copy link

gabelivan commented Jul 25, 2023

@piotrbak Two compatibilities were just added to Asset CleanUp, and they will be pushed in the releases of Asset CleanUp Lite and Pro:

  1. "Settings" -- "Optimize JavaScript" -- "Combine loaded JS (JavaScript) into fewer files" is automatically disabled when the following option is turned on in "WP Rocket": "File Optimization" -- "JavaScript Files" -- "Delay JavaScript execution".
  2. "Settings" -- "Optimize CSS" -- "Defer CSS Loaded in the (Footer)" is automatically set to "No" (no LINK tag alteration) whenever the following option is turned on in "WP Rocket": "File Optimization" -- "Optimize CSS delivery" -- "Remove Unused CSS"

PS: We could have a Trello board (or something similar) with all the compatibilities, and we could comment there about each one.

@piotrbak piotrbak removed this from the 3.14.2.1 milestone Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: remove unused css priority: medium Issues which are important, but no one will go out of business. 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.

6 participants