Open DahmaniAdame opened 1 year ago
@DahmaniAdame to confirm, it's about the scripts and we should exclude scripts from:
@piotrbak yes. That should only be applied to scripts for now.
We can take that opportunity to introduce our own skip
attributes to help 3rd party devs to skip scripts at will without requiring to use a filter for that.
I discussed with Mostafa the possibility of introducing a skip
attribute handling on RUCSS as well to help with cases like this one - https://github.com/wp-media/wp-rocket/issues/5283
We could use wpr-skip
as all-in-one skip attribute, and wpr-skip-
+ feature abbreviation
for feature-specific exclusions. Like wpr-skip-dje
for excluding a script from Delay JavaScript Execution, and so on.
Developers from borlabs are also requesting we support data-noptimize
and data-no-optimize
to exclude JS files from our optimizations
https://secure.helpscout.net/conversation/2414653718/453464?folderId=2683093
Before submitting an issue please check that you’ve completed the following steps:
3.13.1
Describe the bug Some plugins/themes/services will use a hint about assets that they don't want to see optimized further by setting to
true
the following attributesdata-noptimize
anddata-no-optimize
,data-no-minify
or setting to false the following attributesdata-cfasync
anddata-optimized
as they know it might cause issues.As a preemptive measure, we can respect that hint and automatically exclude them from modification, JavaScript defer and delay.
Note that for
data-noptimize
anddata-no-optimize
we should only exclude them if they are set to true by either having the attribute being added with no value or having1
ortrue
as a value.For
data-optimized
anddata-cfasync
, the check should be for0
orfalse
values.One example is Antispam-bee. They add a script with
data-noptimize
, and if delayed, it will prompt an error on the Accessibility audit on Lighthouse.Another example is Mediavine using it on their script that we are automatically excluding from combination and Delay JavaScript Execution:
Behavior matrix:
data-noptimize
anddata-no-optimize
set totrue
or1
= exclude from all optimizations.data-optimized
set tofalse
or0
= exclude from all optimizations.data-no-minify
set totrue
or1
= exclude from minification.data-cfasync
set tofalse
or0
= exclude fromjs defer
andjs delay
as a precaution sinceCloudflare Rocket Loader
that the attribute is meant to control has a similar behavior.To Reproduce Sited example of use cases.
Expected behavior We should respect hints about exclusion from optimizations as a preemptive measure.
Screenshots N/A
Additional context Ticket involving the Antispan Bee - https://secure.helpscout.net/conversation/2229183958/417412
Backlog Grooming (for WP Media dev team use only)