roborourke / wp-less

Provides a LESS compiler compatible with wp_enqueue_style() for rapid CSS development in themes and plugins.
MIT License
217 stars 55 forks source link

Fix cache refresh when switching themes #43

Open cehwitham opened 11 years ago

cehwitham commented 11 years ago

Using the code included in two different themes, switching between themes doesn't update the cache so the newly selected theme still displays using the old stylesheet.

lkraav commented 11 years ago

So this is what I'm running into. +1000

lkraav commented 11 years ago

Maybe the easiest way to not touch upstream code here is to filter get_cache_dir() to make stuff like "wp-less-" . basename( get_stylesheet_directory() ). Going to try this now.

lkraav commented 11 years ago

Win https://gist.github.com/lkraav/7203211

roborourke commented 11 years ago

@lkraav Hi Leo - sorry I'm just catching up with this. I should be able to invalidate the caches on the switch theme hook so that might work. Alternatively I could use a theme specific & site specific sub directory to add multisite support. Thanks for the ideas :)

ansonphong commented 10 years ago

Hi, I'm currently running into a similar issue and I'm looking for a way to run a callback function which would invalidate the CSS cache.

The context I'm working with is a Theme which is customizable from the WP Admin - so the user can change the background color for instance. After they save that new background color in the admin, it's using PHP to inject the variable with the 'less_vars' hook, but the cache isn't being updated until I make some edits to the LESS files.

Is there a simple callback I can run which invalidates the cache?

roborourke commented 9 years ago

Hopefully fixed by #73