9 points · by glyphobet · 17y ago · 14 comments
Indeed, instead of Bos ignoring this guy's argument, it seems to me it's the other way around. The standards body's response to "add variables to CSS" is "why? that's an application-layer concern, easily handled by any web development framework, which has nothing to do how browsers actually process style information". The onus is in fact on the advocates of extending CSS to explain why this feature is so important browsers should be required to implement it.
It's also just bad engineering to add features at lower layers that are just as effectively handled at higher layers. The end to end argument in systems design doesn't just apply to network protocols.
If they, and Bos, have any clue about what they are doing, they should tell us how to solve this problem, instead if asking the inane question you put in their mouths. What Bos comes up with in his essay is basically 'search-and-replace' and other 'tooling'. Well, why don't we just drop variables in our programming languages as well? We can just 'search-and-replace', can't we?
Really?
Never ?
I've got to disagree with this.
All possible changes that one might make to a codebase should be evaluated in terms or ROI (return on investment).
If a 1 day project creates X value, and a 3 day project creates 5 X value, then the latter project delivers more bang for the buck, and that's where resources should be allocated.
To ignore the amount of work that a task takes is to blind oneself and discard rationality.
However, if the customers have a specific pain point, our jobs are to alleviate that pain, not sit around and say, "It's too hard."
The question isn't whether to implement higher-level stylesheets. It's where to implement them.
The only big design decision would be whether to allow writing to document.variables from JS (or, to rephrase, whether to parse the JS entities permanently upon recognition into their textual values before parsing can continue, or to have them continue to exist as a special kind of DOM node—though rendered as their current textual equivalent—that will reflow the document if their dependent values are altered.)
If JS entities aren't parsed away, it would change the way we interact with the DOM entirely—we probably wouldn't bother defining any constants in CSS itself any more; we'd just inject them. It would reverse the data-flow between Javascript and mark-up, even beyond how much AJAX already has: we wouldn't need to set specific things in the DOM, but instead just have those DOM nodes be an observer of our actual, working value. For example, "document.body.styles.background-color = document.createVariableElement(spinner.color);" as a line of Javascript would make the background-color of the page "watch" the current value of the spinner. In fact, if this method were used, you technically wouldn't need a separate variables.json document, because you could just dynamically create all the JS entities in JS (which is probably how it should be.) However, you could create one on top of JS entities, if you wished, using a library.