If your sass files take time to compile and if Node-Sass supports all the features you used, then go with Node-Sass! If installing Dart-Sass(Dart VM) on your machine is not a problem, Dart-Sass is the best option. Also consider Node-Sass is deprecated and they won't add new features.
Node-sass is a library that provides binding for Node. js to LibSass, the C version of the popular stylesheet preprocessor, Sass. It allows you to natively compile . scss files to css at incredible speed and automatically via a connect middleware.
Migrating from Node-Sass to Sass (Dart-Sass) with npm - DEV Community.
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
As this answer gets up-votes every day, I thought maybe it is worth diving deeper into this topic.
Considering sass-lang website:
Dart Sass is the primary implementation of Sass, which means it gets new features before any other implementation. It's fast, easy to install, and it compiles to pure JavaScript which makes it easy to integrate into modern web development workflows.
Dart-Sass is fast, but not the JS compiled version. Practically when we say Dart-Sass there are two options:
I compiled Bootstrap 4 Sass file to CSS with Node-Sass, Dart-Sass and Dart-Sass(JS) and you can see the following result:
I blogged about it here, you can read more about it here.
24/01/2021
As it's written in official node-sass github doc, node-sass is deprecated.
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
So I guess it would be better to chose dart sass if you plan long term or to stay up to date.
node-sass may be faster than dart-sass, but as of writing this dart-sass is the only library which implements the @use
rule, which is strongly recommended over @import
. According to the official sass-lang website:
What’s Wrong With
@import
? The@import
rule has a number of serious issues:
@import
makes all variables, mixins, and functions globally accessible. This makes it very difficult for people (or tools) to tell where anything is defined.Because everything’s global, libraries must prefix to all their members to avoid naming collisions.
@extend
rules are also global, which makes it difficult to predict which style rules will be extended.Each stylesheet is executed and its CSS emitted every time it’s
@import
ed, which increases compilation time and produces bloated output.There was no way to define private members or placeholder selectors that were inaccessible to downstream stylesheets.
The new module system and the
@use
rule address all these problems.
Additionally, @import
will be gradually phased out over the next few years, and eventually removed from the language entirely.
In order to stay up-to-date with the best practices in Sass, you should use dart-sass (i.e. sass) for now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With