7 points · by dpapathanasiou · 18y ago · 4 comments
First, having native support for variables in CSS would eventually simplify the implementation of a proper (separation of variables from declarations among other things) "CSS compiler". It would also promote a better style of CSS because I don't think very many people use a framework with CSS variable/declaration separation.
Second, in theory CSS is the domain of designers and they presumably use "standard" tools to edit CSS directly so they don't have variable support I'm guessing?... I'm sure we could be surprised how much CSS is edited by hand.
At the very least, "variables" should be implemented with multistage processing like MetaLua or Template Haskell. Really, I just want to say something like this:
foo = { background-color: #coffee; margin: 42; }
bar.span { ,foo; something-else }
baz.span { ,foo; something-else }
I know I can do this with HTML (apply more classes), but I can envision cases where this is less hackish (or more natural, anyway).Edit: the MetaOCaml people have some good reading about multistage programming: http://www.cs.rice.edu/~taha/MSP/