I was wondering what are the differences between node-sass and gulp-sass? What are the pros and cons of each version? I see that on www.npmjs.com node-sass has more than double of an advantage in downloads. Does this make it better? Is there a difference in compiling speed?
If you're getting a node-sass error, that's because the new version of gulp-sass doesn't include node-sass anymore. What you want to do is swap out node-sass, for plain ol' sass. Update your gulp-sass to the latest stable version. const sass = require('gulp-sass')(require('sass')); // Gulp plugin for Sass compilation.
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.
It enables a developer to create code in another language and translate it into CSS , and it compiles SASS to CSS at an incredible speed. It has introduced various new features like: nesting. data variables.
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.
The difference between them is that gulp-sass
has node-sass
as a dependency :)
gulp-sass
is a plugin for Gulp - an excellent build tool.
And it uses node-sass which it itself is using lib-sass which is a Sass compiler written in C or C++.
That makes it faster than Ruby Sass, but it is not as feature complete I think, but they are pretty close to each other.
I think that the Sass project recently switched from Ruby Sass to LibSass as the 'official' compiler / tool - but don't arrest me on that. :)
The cons of gulp-sass
is that you get more than just node-sass
- you also get gulp-utils
and other things - which is a problem if you are not using Gulp in the first place. ...
And if you are using Gulp, then you are all set with gulp-sass
, obviously.
To complicate this answer even further, there is also gulp-ruby-sass
which uses Ruby Sass directly.
That means that you have to install Ruby and Sass before you can use it, but you will be able to use Compass and other Ruby Sass stuff with it.
It is going to be slower, though..
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