Hacker News new | ask | show | jobs
by userbinator 4430 days ago
After looking at the spec, I'm wondering does this really save anything for the client, vs. doing this in a CSS preprocessor? Instead of spending the time compiling once and then having clients interpret declarations, every single user who visits the site will have their browser perform the same computation, every time they visit a page that uses these. It's also another source of significant complexity to the browser.
2 comments

CSS Variables are a misnomer. They're custom properties that obey cascade and inheritance.

CSS preprocessors can do only lexically scoped substitutions. With CSS "variables" you can have values inherited within DOM's scope.

Can you give an example of a situation where you would rather have cascading variables than lexical scope?
• JS libraries implementing polyfills for new CSS properties or their own CSS-like behaviors (e.g. `--masonry-display: jagged-grid`)

• themes (`--theme-color` that can be inherited and overridden just like `color` would)

Less dependency on third party tooling.

Many companies are weary of extra dependencies on their developer tooling.