Clear cache only for a specific plugin?

Clear cache only for a specific plugin?

by Christos Savva -
Number of replies: 2

Hello Moodlers,


Is there a way to specify for which css file I need to clear the cache?


Having  in my config.php

$CFG->themedesignermode = 1;

Takes ~4minutes for Moodle to open each page. I was wondering if there is a faster way to clear cache and show changes only for the specific file or specific plugin?


Kind regards

Christos

Average of ratings: -
In reply to Christos Savva

Re: Clear cache only for a specific plugin?

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Unfortunately, you can't purge a particular CSS file from the cache.  The files are combined into one and cached together, so there's no mechanism to purge the CSS for a particular plugin.

I have two strategies when working with CSS that I've found quicker than Theme Designer Mode.  Firstly, you can manually purge caches (either through /admin/purgecaches.php or /admin/cli/purge_caches.php) then reload the page, which means you one have the extra wait when you've done something rather than on every page.
Secondly, on the Style Editor tab of Firefox's Developer Tools, there's an option to import a file (looks like a box with an upward arrow).  If you import the file you want to edit, the rules will be applied to the current page, overriding the same rules in previously loaded files.  You can then make changes in Firefox's editor and see them reflected live.  When you're done, save the file, purge caches and reload to check the final result.
Average of ratings: Useful (1)
In reply to Mark Johnson

Re: Clear cache only for a specific plugin?

by Christos Savva -

Hello Mark and thank you for taking the time to reply smile


I have tried the first solution, clear cache using CLI. When I used CLI option the clearing of cache was indeed fast but reloading of the page on Moodle takes too long again.


I will try the second solution.


Thank you