-
Notifications
You must be signed in to change notification settings - Fork 8
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
Automatically exclude assets from popular caching/optimizer plugins #54
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54 +/- ##
============================================
- Coverage 91.02% 90.53% -0.50%
- Complexity 282 304 +22
============================================
Files 21 24 +3
Lines 836 898 +62
============================================
+ Hits 761 813 +52
- Misses 75 85 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
While I understand the concept, I kind of don't like that with that PR also code which is not affected by the PR is changed (psalm/code style). Regarding the topic itself: Shouldn't we move the "ignoreCache" to the Asset, to allow deciding which assets are cacheable and which are not? Currently you can just enable/disable it for all, but not for specific ones. |
For the first part, I would like @Biont to jump in. I honestly don't know what to do when I work on packages that have errors in code style - fix it or leave it :) It looks like the opinions between individuals vary. For the second part, I will also ask @Biont to jump in. Should the functionality be applied globally or individually? |
I can get behind the notion that the psalm fixed potentially cloud the view on the functional changes. I guess it was done here because it feels bad to publish a PR with broken CI - even if the problems are not introduced by new code. Moving the exclusion to the actual asset sounds reasonable.
|
A common nuisance in supporting and maintaining plugins is that performance optimization plugins tend to be quite aggressive about optimizing CSS/JS assets which often leads to broken functionality without immediate wrongdoing on our side. Examples include:
Usually, this is undesired and leads to complications which the site admins need to sort out themselves. It leads to support tickets on our side and frustration on end-user-side.
However, a few of these plugins offer an API to exclude individual assets from being processed. In the past, we had to implement these blacklists on a per-plugin basis. But thanks to the increasing adoption of this library, we are now in a position to introduce a common entrypoint for this kind of configuration. So we would like to implement new functionality that makes exclusion of our assets a straightforward ting.
This PR adds an
IgnoreCacheHandler
. IgnoreCacheHandler applies per-plugin specific logic to exclude plugin files from minifying and combining. Currently, two WordPress plugins are supported:Usage: