I'm making a web app that is VERY customizable (colors, etc). I am trying to find the easiest way to make this easy for me to develop. The best thing I've come up with so far is to have mustache-like CSS code and replace the stuff with values from localStorage
through JavaScript, like this:
CSS code:
<style id="customsheet">
.someclass{
background-color:[classBackground];
color:[classColor]
}
#anelement{
font-family:[eltFont];
font-size:[eltFontSize];
}
</style>
And replace, for example, [eltFont]
with localStorage.eltFont
using JavaScript, which modifies the innerHTML
of the <style>
element.
What I'm asking is, is there a better/"correct" way to do this? The way I thought up seems...weird.