Let me tell you how I implemented customisable themes on my website, and see if it's of any help to you.
To start with, I use LESS. Wherever I have something customisable (usually colours, but sometimes background images too) I drop in a variable.
Then I have a _colours.less
file, which simply defines all the variables, and gets imported at the start of every other .less
file.
Finally, I present the users with an interface to edit these variables in a user-friendly manner.
At run-time, the PHP checks:
- Does the main
core.css
file exist?
- Is the
core.css
's modification time more recent than the _colours.less
modification time?
- Are the modification times of all
.css
file being used in this page more recent than the corresponding .less
file's?
If any of the above result in the answer "no", then the given .css
file is recompiled on-the-fly using the PHP lessc
class (that basically implements the LESS compiler).
In this way, users can easily create their own custom themes, but it doesn't interfere in any way with my ability to update the site's layout.