Node.js, node-sass, and fileWatch
Using npm
to run shell commands is all well and good, but as you can imagine it has its limits. When you want to really complicate things, you'll need to start writing tasks in Node.js. To do this we'll need that index.js file we specified in our package.json entry point field.
Create a file called index.js. Next we'll need to download a package which compiles watches our Sass files. The package is node-sass
. The node-sass
is a Node "wrapper" of the LibSass
port of Sass. This means we write code familiar to Node which then uses LibSass
to actually compile and do whatever else we ask.
So first we'll run the command to download and install node-sass
into our project:
npm install node-sass --save-dev
This tells npm ...
Get Mastering Sass now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.