Azima
Azima

Reputation: 4141

compile sass with npm

I am new to npm and encountered this scripts in package.json file.

"build": "node ./node_modules/node-sass/bin/node-sass  src/css  -o dist/css"

And trying to understand this command bit by bit.

I know that this compiles sass file to dist/css.

But what does this node ./node_modules/node-sass/bin/node-sass src/css do?

Upvotes: 0

Views: 625

Answers (1)

Aritra Chakraborty
Aritra Chakraborty

Reputation: 12542

It is basically running the node-sass which compiles sass files from src/css and writing it to(output) dist/css file.

Whenever you install a local npm package using npm install it goes inside the node_modules folder.

So, the node-sass package is located at node_modules/node-sass/ of your project. And the binary file(the executable file) is located inside the bin folder. This is kind of traditional. Most package which can be installed using the -g or --global npm switch has the binary inside bin folder.

Sometimes, the binary is just a js file sometime it's compiled bytecode.(like .exe files in windows)

Upvotes: 1

Related Questions