What to do if I need to delete only the CSS?

What is the name of the domain?

N/A

What is the issue you’re encountering

N/A

What are the steps to reproduce the issue?

Good morning, is there a way to delete, for example, only the CSS or JS files contained in my cache? I ask this because it seems to me that it’s not possible, and that the only option is to clear the cache by specifying an exact URL.

If it’s not possible, I have another question: if I’ve set a rule for files such as JPG, WebP, WOFF2, etc., to remain in the reserve cache for a month, what happens when I clear the entire cache - because I can’t target just one type of file? Are these files also deleted, or do they still respect my custom rule?

Thank you very much.

Haven’t tried, however using custom cache key or header, we might be able to:

Otherwise, on Enterprise by cache-tag:

Using a Worker, you might be able to trigger all *.css or *.js :thinking:

E.g. if url.pathname.endsWith('.css') then purge the cache for the URL.
Would have to bound the Worker to domain.com/*.css so it’ll do it in such case.
It’ll act as e.g. automate script to purge each .css file for your domain, which is similar to purge by single URL.

Or the alternative approach to use Cloudflare Cache API (for bulk purging), but that clears all the assets and not just .css:

Thank you, @fritex, you’re very kind. You see, regarding APIs, it would be incredibly useful if the WordPress APO plugin had a feature allowing operations via API specifically on CSS, JS, or even HTML. Instead, you’re limited to just two options: either clear everything or clear via a direct URL, with a maximum of 30 resources at a time.

You can understand how this makes it impossible to work efficiently… and that’s why I’m wondering if the plugin has been abandoned :confused:

UPDATE: After reading the documentation, I understand why this isn’t possible - it’s only available starting from an Enterprise plan. So, those with a Pro plan are out of luck, even though it seems like a fairly simple feature to implement.

This topic was automatically closed after 15 days. New replies are no longer allowed.