Should we still use Sass?
- sass
- css
- stephanie eckles
- smashing magasine
Thu, July 7, 2022
Since IE11 died a few weeks back (RIP 🍾 🎉), and because I’ll soon(ish) start working on design systems ( 🤫 ) I found myself thinking:
Should we still use Sass? Should I move away from it?
Is it still necessary today, or has vanilla CSS closed the gap?
Today we have:
- ✅ custom variables (great support)
- ✅ cascade layers (well supported)
- 👷♀️ scoping & nesting CSS coming (but zero browser support yet)
and also
- 👷♀️ color mix (not yet)
- 👷♀️ color contrast (not yet)
- ✅ color-scheme preferences light/dark themes
Before I could actually sit and think this through I fell on this episode of Smashing Podcast, interviewing Stephanie Eckles. Great stuff. At one point they reached this topic. She still uses Sass. Here are her reasons:
Mostly:
- organization: to compile her stylesheets, keep them separated (as components, … (shes uses BEM))
- functions: looping through token, spit out different utility classes
but also:
- in design system context, better management of “tokens” of how different customizations enter the stylesheets
- mixins -> but less, custom properties are filling the gap of need
But she too is using it less and less. Now, for example: is() & where(): simplify her selectors in a way she was previously using Sass for
I also think that has has() will be key in replacing the & used as some kind of parent selector in Sass. Just waiting for its support to improve 😬
So here we are. Getting near a place where we’ll be able to let Sass go.
Personally, nesting is something I’m really looking forward, but I am using Postcss to polyfill it, so I don’t need Sass for it. And has() will be of great use too.
Then the functions can be hard, but how many projects are actually using it?
I guess for a big project, like a production design-system, you might still need to use it. And I clearly think that it is not worth moving away from it now if you’re in a project that was using it for years. Not worth the effort to move out of Sass to then move everything back to PostCSS equivalents. But if you’re starting new projects, I guess I would not be reaching out for it (and as a matter of fact, this site is not using it) 🚀