tl;dr = Can we add “sass” to the default Webpacker configuration and drop the unmaintained rails-sass
→ sassc
→ libsass
gem?
Hi Rails Team!
Over at @sass HQ, we’ve been busy over the last couple of years with a new implementation of Sass built in the Dart language, but with extensions and compilation targets in both native code and in JS.
We know it can get a bit confusing, but there are actually 3 possible “Sass” implementations that you might use in your Gemfile:
- Ruby Sass (long deprecated, original implementation)
- LibSass Powered Implementations–
node-sass
,sassc
, and many other targets that uselibsass
in the background - Dart-Sass Powered Implementations–
sass
npm module, andbrew install sass/sass/sass
Trust me, we know that this is a bit of a hot mess, but that’s what happens when you are a 14 year old language that’s evolved to become ubiquitous! (Also, fun fact, YESTERDAY was Sass’ 14th birthday!)
The Sass Core Team has deprecated both Ruby Sass, and all LibSass powered implementations. Why? Simply because libsass was unable to find a team of C++ developers to keep up development at pace with the version that Google sponsors (Dart-Sass). We had two amazing people trying their best part time, but just the weight of a C++ implementation is too much.
Pros of Changing
- You can use Sass’ powerful module system
- Far fewer bugs
- Continuously added features
- Quickly added support for new CSS features
Cons of Changing
- LibSass/sassc gem is much faster than the Javascript-based
sass
npm module - There are slight incompatibilities, but only in extreme edgecases and in every instance, the reference implemenation handles it the preferred way- but it is different.
Also, Dart has recently added the ability to compile native versions of npm extensions, effectively becoming the same output as libsass. This will eventually make its way into the npm sass
module, but at this moment, it’s slower.
As the person who started the libsass
project years ago- in attempt to help Sass gain more market share, it pains me to ask to help us end the project faster, but the change is incredibly simple.
In all of my Rails projects, I’ve switched over and am extremely happy with the work that @nex3 and team have been doing on the Dart Sass implementation and the improvements across the board that they’ve made with the language’s stability. LibSass is no longer going to receive any updates or bug fixes.
I’m happy to write up the patch that would make the change in new projects.
Happy to answer any questions! Thanks!