I’m looking to add some basic theme support to my web application, with users being able to customise various parts of the look. These include things like colours, text sizes, fonts, other basic things. I will be storing these in the database and loading them each time a page is accessed.
My question is, how do I go about generating a dynamic CSS file based upon these database values?
I would prefer to do something that is cache-able, but extensible so that if I want to add more editable styles then it wouldn’t be a bit issue.
I think the simplest way would be to add something like the following action method to a controller:
Now in your page you can reference it like so:
OP EDIT: I made some small changes to the method, but the general premise remains. This is the version I used: