4 ms·
Indeed. I think CSS shouldn't have variables. You should use a server-side program dynamically creating your CSS, perhaps, but CSS variables seems like more tro
by wind 19y ago
Indeed. I think CSS shouldn't have variables. You should use a server-side program dynamically creating your CSS, perhaps, but CSS variables seems like more trouble than it's worth.
- Hexstream 19y agoI agree about using a server-side program to dynamically create CSS, but I still think it would be beneficial to have CSS variables. 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.
- jrockway 19y agoI agree. 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/ http://www.cs.rice.edu/~taha/MSP/