Does the W3C not have internet access to learn about existing solutions and least try to emulate the good parts? LESS and SASS are much better about variables, what the heck were they thinking? background-color: var(--best-gray-ever); Not exactly intuitive or easy to parse at a glance.
CSS Variables in Firefox 31 – new syntax
21–30 of 54 posts
Re: CSS Variables in Firefox 31 – new syntax
#22 background-color: var(color);?Re: CSS Variables in Firefox 31 – new syntax
#23Re: CSS Variables in Firefox 31 – new syntax
#24These are not like SASS variables. I think calling this variables is causing unnecessary confusion. This feature adds custom properties . CSS had custom vendor properties like `-webkit-foo`, and now you can have your own properties with vendor == "", so it's `--foo`.
I think this is just a problem of nomenclature. In CSS, a statement such as font-color : red; comprises a "property" (left) and a "value" (right). The draft W3C proposal allows you to specify a "custom property" and assign a value to it, thus: --header-bg-colour : #ff5533; You can then reference this elsewhere by saying: header { background-color : var(--header-bg-colour); } Isn't that just how you use a variable (wr…
Re: CSS Variables in Firefox 31 – new syntax
#25Woah. CSS variables look like compiler flags. There goes the W3C reinventing the wheel when Sass, Less and others have already laid out how to assign variables just fine for years.
A preprocessor cannot possibly implement CSS variables with cascading because it the value is resolved against a live context.
In other words, you can actually change the variable at runtime with rules that target different selectors.
As such, the "variables" are in fact functions.
Re: CSS Variables in Firefox 31 – new syntax
#26Can anyone think of a use case for this beyond what a precompiler (Sass, Less, Stylus) can do?
I think the idea is you use this rather than a precompiler.
Re: CSS Variables in Firefox 31 – new syntax
#27Preprocessors are an inferior solution, limited by the semantics of CSS and leading, by the pervasive use of macros, to needlessly large CSS file sizes.
Re: CSS Variables in Firefox 31 – new syntax
#28Does the W3C not have internet access to learn about existing solutions and least try to emulate the good parts? LESS and SASS are much better about variables, what the heck were they thinking? background-color: var(--best-gray-ever); Not exactly intuitive or easy to parse at a glance.
The w3c has been failing at their job for some 15 years now. Enabling drm in html5 and giving the mpaa a seat on their board should have been the last straw. Ignore them, and start looking to WhatWg
Re: CSS Variables in Firefox 31 – new syntax
#29Woah. CSS variables look like compiler flags. There goes the W3C reinventing the wheel when Sass, Less and others have already laid out how to assign variables just fine for years.
As other posts have stated, CSS variables are not the same thing as preprocessor variables. Specifically, they cascade. A preprocessor cannot possibly implement CSS variables with cascading because it the value is resolved against a live context. In other words, you can actually change the variable at runtime with rules that target different selectors. As such, the "variables" are in fact functions.
Re: CSS Variables in Firefox 31 – new syntax
#30Writing your styles in javascript is a better option. You get variables, as well as functions and modules (e.g. with browserify), all with sane syntax and semantics (no "cascade"). Preprocessors are an inferior solution, limited by the semantics of CSS and leading, by the pervasive use of macros, to needlessly large CSS file sizes.