- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 10 Apr 2012 10:21:22 -0700
- To: www-style list <www-style@w3.org>
[Resent for great justice, this time with a link to the spec.] I'm happy to announce that CSS Variables has just been published as a First Public Working Draft! http://www.w3.org/TR/css-variables/ Large documents or applications (and even small ones) can contain quite a bit of CSS. Many of the values in the CSS file will be duplicate data; for example, a site may establish a color scheme and reuse three or four colors throughout the site. Altering this data can be difficult and error-prone, since it's scattered throughout the CSS file (and possibly across multiple files), and may not be amenable to Find-and-Replace. This module introduces a family of custom user-defined properties known collectively as variable properties, which allow an author to assign arbitrary values to a property with an author-chosen name, and then use those values in other properties elsewhere in the document. This makes it easier to read large files, as seemingly-arbitrary values now have informative names, and makes editting such files much easier and less error-prone, as one only has to change the value once, at the variable definition site, and the change will propagate to all uses of that variable automatically. Variables have many more uses beyond helping maintenance. One example is theming - a generic stylesheet can be created that uses variables for important colors, backgrounds, etc., with the expectation that it will be paired with a site-specific stylesheet that gives all the variables definitions. Many existing variables systems provided inspiration for this module, including SASS <http://sass-lang.com/> and a previous spec defining pure CSS Variables written by Dave Hyatt and Daniel Glazman <http://disruptive-innovations.com/zoo/cssvariables/>. The approach this spec eventually settled on - defining variables through CSS properties rather than at-rules - offers a strict superset of the functionality of those inspirational specs, and provides several additional benefits. This spec is in its infancy, and implementation has only just begun. Feedback on the features and syntax is very welcome. We are attempting to keep this first iteration of the spec as simple as possible, as even this basic functionality is much more complex than it might appear, and so will likely defer feature requests until Level 2, but keep them coming anyway so we know what to work on next! ~TJ
Received on Tuesday, 10 April 2012 17:22:15 UTC