How to install Sass compiler

Last Updated:

How to install Sass compiler

To install Sass compiler, follow these steps

  1. Download Node.js and install it (very common procedure).
  2. Open your command prompt (windows user) or terminal (mac user) and change the directory to a folder where you want to install node-sass.
  3. Type 'npm i node-sass' and hit Enter. You are ready to thrive Sass.

How to work?

  1. Create a file with an extension .scss (say 'mysass.scss') inside a folder of any name (say 'sassfolder') in a directory where you have installed node-sass (for convenience).
  2. Copy and paste any sass code into 'mysass.scss' file. You can find a sample sass code within this page.
  3. Now its time to convert your sass file to css file.
  4. Open your command prompt (windows user) or terminal (mac user) and change the directory to a folder where you have installed node-sass.
  5. Type the following command and hit enter.
Command Prompt
sass --watch sassfolder/mysass.scss cssfolder/mycss.css

Now Sass compiler will create a folder 'cssfolder' where you can find your css file 'mycss.css'.

Online Sass to CSS Converter

You can use online sass compiler for learning purpose because that's the fastest way of learning Sass.

In the following example, we will convert a sample Sass code to CSS code.

Example

SASS TO CSS CONVERTER
p{ color: red; a{ color: green; } }

Share this Page

Meet the Author