Select Page

Hi, I have created a very nice and minimal working scss/sass to css compiling setup on my local and i am sharing the steps to do it with you.

Step 1 – install node js from here – https://nodejs.org/en/

Step 2 – initialize package.json file with “npm init” command inside terminal on the root folder location of your project. This will create a package.json file.

Step 3 – install node-sass – https://www.npmjs.com/package/node-sass with the following command on terminal on the root folder “npm i node-sass”

Step 4 – Inside package.json add the following script in scripts section:
“compile:sass”: “node-sass ./assets/scss/style.scss ./assets/css/style.css -w” you can change the path according to your file locations.

package.json file

Step 5 – Run command “npm run compile:sass” in terminal everytime you want to compile sass to css. Note the terminal will watch for any sass file changes and will automatically convert it to css files. It may also show error if there is some issue. Also note that you might need to stop command by pressing “ctrl + c” in the terminal and restart “npm run compile:sass” command if you have added or included a new scss file to watch it.

Terminal

Thanks!