![install sass with node install sass with node](https://i.stack.imgur.com/CmFw0.png)
The new module system launched in October 2019 supposedly only comes to Dart Sass which means sass is definitely going to get it first. For example, the number of open issues isn't a measure of bugs. NPMCompare has a nice comparison of them as projects but you have to study each row of numbers because it's rarely as simple as more (or less) number is better. That just has a nice feelin in sass's favor. It's definitely a feather in sass's hat that Dart Sass is the "primary implementation" of Sass. I don't know much about the sass-loader Webpack plugin but it apparently works with either but they do recommend sass in their documentation.
![install sass with node install sass with node](https://miro.medium.com/max/1400/1*0_Cbi17diEMjT3Fn2PN-Pw.png)
But if you're forced to have to wait 1.4 seconds on every Ctrl-S when Webpack or whatever tooling you have starts up sass it might become very painful. If you're only doing it once, who cares about a couple of hundred milliseconds. The speed difference may or may not matter. Who even has Python 2.7 installed anymore? Being able to avoid node-gyp seems like a win for sass. I don't know about you but I'm very skeptical that node-gyp ever works. Whereas /tmp/just-node-sass/node_modules directory is 3,658 files and folders weighing a total of 15.2MB.
![install sass with node install sass with node](https://user.oc-static.com/upload/2018/10/21/15401299708502_npmInit.jpg)
The /tmp/just-sass/node_modules directory is only 113 files and folders weighing a total of 4.1MB. Ĭonsidering that sass is just a JavaScript compilation of a Dart program, all you get is basically a 3.6MB node_modules/sass/ file. Mkdir just-node-sass & cd just-node-sass & yarn init -y & time yarn add node-sass & cd. Mkdir just-sass & cd just-sass & yarn init -y & time yarn add sass & cd. But you minify both outputs and the pretty print them (with prettier) you get the following difference: The unminified CSS difference primarily in the indentation. Sass took 1467ms result 176kb 139kb Output Versus sass took 1423ms result 176kb 139kb node_modules/bootstrap/scss/bootstrap.scss (version 5.0.0-alpha1) and the results are after 5 runs: node-sass took 269ms result 176kb 139kb In another example, I ran sass and node-sass on. Here's my ugly benchmark test which I run about 10 times like this: node-sass took 101ms result 180kb 92kbĪnd here's the same thing for sass: sass took 751ms result 173kb 92kb Transformed into CSS it becomes a ~180KB blob of CSS (92KB when optimized with csso). I took all the SCSS files behind the current MDN Web Docs which is fairly large. node-sass on the other hand is a wrapper on LibSass which is written in C++. sass is a JavaScript compilation of Dart Sass which is supposedly "the primary implementation of Sass" which is a pretty powerful statement.
#Install sass with node install#
sass) in Node you have the choice between sass and node-sass. node sass Is there a way to install node-sass without download the binding. See Dart Sass's documentation for more information about its JavaScript API.To transpile. Import 'dart:io' import 'package:sass/sass.dart' as sass void main ( List arguments ) ) Name : my_project dev_dependencies : sass : ^1.50.0Ĭreate a compile-sass.dart file like this: Make sure its bin directory is on your PATH.
#Install sass with node plus#
You can also use Dart Sass as a Dart library to get the speed of the Dart VM plus the ability to define your own functions and importers. See sass -help for additional information on the command-line interface. To install Dart Sass on the command line, check out the installation instructions. Once you've got it running, you can use it compile files: sass source/index.scss css/index.css Dart Sass's stand-alone command-line executable uses the blazing-fast Dart VM to compile your stylesheets.