Hook into theme config save event?

I would like to manipulate a theme file whenever the theme settings are saved. I’m not sure how to check for that though… Would I best do this on AdminSave or onAdminAfterSave?

And I tried dumping things on these hooks, but nothing turns up in the debugger. var_dump('?') gives me nothing, dump('?') doesn’t either.

Your ideas are much appreciated!

? Which file exactly and why? Sounds very suspicious

Heh, yeah. I’ve thought about the best way to do this, but so far nothing seems optimal.

The file I would like to manipulate is the input.css file from my Tailwind configuration. I’d like to change a few classes based on a theme setting. If I can’t think of a better way, I’ll do it manually… but switching a theme setting and then having everything change accordingly would really be very nice.

You don’t have to change file and that would be discouraged. I would try something like custom TW theme switching depending on data attribute. And this data attribute should be changed depending on Grav theme setting. Would need more research for me to tell for sure if this is the way, but definitely not file manipulation

Hmmm, yeah no, can’t do it with CSS variables. Loading a different preset would be ok, but how would I do THAT on changing a config setting?

Apart from that, I think manipulating the file would be ok in my case. It’s my own theme and it won’t be used by others. Basically I just want to save myself from having to do it manually.

In your theme class you can define what assets to load based on any config setting, I think :thinking:

Yes… the thing is, I don’t want to generate x versions of css just in case I might need them. I’d rather change a few variables dynamically. Now, this is quite possible with CSS variables of course, but that didn’t work for my original problem. I wasn’t thinking straight though, it was easily doable with an extra class :sweat_smile: