2 ms·
It would be nice if it also supported SCSS. Writing vanilla CSS variable syntax over and over can get extraordinarily annoying. Also if you want scoped variable
by 65 5y ago
It would be nice if it also supported SCSS. Writing vanilla CSS variable syntax over and over can get extraordinarily annoying. Also if you want scoped variables SCSS has support for that while vanilla CSS uses global variables.
I'd really just rather write $color-blue rather than var(--color-blue);
- spankalee 5y agoSass and CSS variables aren't semantically equivalent. CSS variables are dynamically scoped.
- eyelidlessness 5y agoNot disagreeing, only adding this nit to hopefully shortcut some bickering. (Apologies if this causes more bickering) Sass variables are both lexically and dynamically scoped. The scope is determined by what you define or import before the lexical scope is evaluated. You can inject basically whatever you want based on execution order. That’s more dynamic than most lexical scoping, where definition context determines resolution. CSS custom properties are fully dynamic in the sense that they’re context-free when defined. Like Sass variables, that context can be injected by execution order. The major difference is what constitutes “execution order”. For Sass, it’s evaluation and control flow scoping rules. For CSS custom properties it’s the cascade.