- From: Jens Oliver Meiert <jens@meiert.com>
- Date: Thu, 26 Oct 2017 15:39:35 +0200
- To: W3C WWW Style <www-style@w3.org>
(A side note, I thought this may be of interest.) We’ve had conversations here and there on how variables (or constants) may not have been needed in CSS—Bert Bos once wrote a great essay [1] about the matter. Personally, I’ve also wondered about the decision as variables had always been an option to developers, if only by using PHP and such to generate CSS. What seemed even more interesting, however, was to investigate the great demand for variables. And there’s one interesting detail: There’s a great deal of repetition in style sheets, where some websites use some *declarations* up to *10* times [2]. That amount of repetition quite screams for variables indeed. (In hindsight it also raises the question what problem introducing variables solved exactly. One could argue that they help manage repetition better, but that doesn’t address the problem of repetition itself.) We do know, too, that there’s one approach, though not trivial, to help curb repetition: using declarations just once. I just wrote up a few notes on that process at https://meiert.com/en/blog/dry-css/. I wish to share this here for the same reason as I published the post itself: for more attention on repetition in CSS (less so for the particular approach). Perhaps the Working Group has thoughts on this and can keep an eye on the issue, just in case there are things we could do to counter “wet” style sheets on the spec side. (There is, then, the suspicion that authoring CSS hasn’t really improved over the years, but as this is a slightly different topic I wish to also bring this up only later. Whether and how it affects the group’s work, I’m not sure. Not all of this may need to be solved by the group.) Cheers, Jens. [1] https://www.w3.org/People/Bos/CSS-variables [2] https://meiert.com/en/blog/70-percent-css-repetition/ -- Jens Oliver Meiert https://meiert.com/en/
Received on Thursday, 26 October 2017 13:40:31 UTC