Compiling Sass Using the node-sass Node Package on a Mac
Posted on March 8, 2016 in Node.js, Sass by Matt Jennings
Steps:
- First, install Node.js and NPM if you have not already done so.
- Open up Terminal, type in
cd
, and press Enter on your keyboard to ensure you are in the root. - Install theĀ node-sass package in by typing the command below in Terminal:
npm install -g node-sass
- In Terminal, navigate to the directory that holds
.scss
file you want convert to.css
, and enter the command below which would would convert and compress a file namedstyle.scss
intostyle.css
NOTE: The example below assumes that you have navigatated into a/wp-content/themes/mytheme/
directory. Then the ouputted and compressedstyle.css
file is found at/wp-content/themes/mytheme/style.css
:
node-sass --output-style compressed style.scss style.css --watch