After reading through Chris Krycho’s extremely cool and clever CSS mixin for light and dark variables, I was particularly struck by his conclusion:
The last couple bits I need to knock down to not need SCSS at all are:
- The equivalent of the nice
@use
directive. I think I might actually be able to use Lightning CSS directly along with its interpretation of native@import
for bundling and minification.- Applying the same approach to the syntax highlighting theme shown above for the syntax highlighting theme, for which I also currently use a
@mixin
the same way.
This got me thinking about what I use SCSS for these days. SCSS has been a constant part of my toolchain for twelve or thirteen years now; I feel like it’s been a part of my workflow forever. But it frustrates far more than it delights today, at least for me. The announcement of CSS Nesting in December gives me hope that a major reason to use SCSS is becoming part of the standard spec in the future.
Beyond that, here are the last couple things I need to not need SCSS anymore:
- Like Chris, I need a good
@use
or@import
directive. Today, this is SCSS’s best feature. I hadn’t heard of Lightning CSS before, but now I am going to check it out (although I am wary of replacing a well-known tool with a less well-known tool). - I think browser targets are helpful as a compilation feature, and I am unsure of a way to make that part of the default CSS spec.
- I love using SCSS variables for media queries.
@media (min-width:$bp-m)
is far easier to use, in my experience, than@media (min-width:700px)
or@media (min-width:45em)
. I understand why we can’t use environment variables, but it really is a shame I just can’t write@media (min-width:var(--bp-m))
and call it a day. I don’t know if I’ll ever get this as part of CSS spec. I’m also aware that best practice is probably to abandon variables in media queries and rely on something more conventional, but old habits…
I think the @use
directive is the most important for my needs, and at a certain point, I’d be happy to give up futzing with the developer toolchain around SCSS compilation. Nothing has thrilled me more over my career than watching CSS improve and gain features over the past fifteen years. We’ve gone from floats
to grids
to crazy math formulas inside variables, and as a result, our layouts have been more less rigid and far easier to work with.
It’s still a great time to be a web designer.