Below describes the main steps for setting up a project folder to be able to compile scss files to your css files.
Setup Project
- Make sure you have node installed
- in your terminal try the command
node --versionif you receive a version number likev12.18.0it’s installed. - otherwise install node.js
- in your terminal try the command
- Required files / directory structure
project_name/css/style.cssproject_name/sass/main.scss
- Create the project’s
package.jsonfile. Using the terminal:- navigate to
project_name - run
npm initfollowing the instructions - creates
project_name/package.json
- navigate to
- Install Sass. Using the terminal:
- navigate to
project_name - run
npm install sass --save-dev - creates
project_name/node_modules/all-packages-inside - updates
package.jsonwith the following:"devDependencies": { "sass": "^1.0" }
- navigate to
- Setup compile scss to css script
- navigate to
project_name - update
package.jsonwith the following line in the"scripts"object:"scripts": { "compile:sass": "sass sass/main.scss css/style.css -w" },
- navigate to
- Run scss to css compiler. In the terminal:
- Navigate to
project_name - call
npm run compile:sass - saved changes to
main.scsswill call the compiler and updatestyle.css - to exit the compiler, either close the terminal window or use
ctrl ^cto exit the process.
- Navigate to
Transfer project
- Transfer files / folders
project_name/css/style.cssproject_name/img/all-files-and-foldersproject_name/sass/all-files-and-foldersproject_name/index.htmlproject_name/package.json- DO NOT INCLUDE
project_name/node_modules/
- In renamed
project_name_v2with all transferred folders and files. In the terminal:- Navigate to
project_name_v2 - Call
npm install– this looks at yourpackage.jsonfile and installs any saved dependencies (sass) and recreates theproject_name_v2/node_modules/with-all-required-packages
- Navigate to
- Run scss to css compiler. In the terminal:
- Navigate to
project_name_v2 - call
npm run compile:sass– saved changes tomain.scsswill call the compiler and updatestyle.css - to exit the compiler, either close the terminal window or use
ctrl ^cto exit the process.
- Navigate to

