For this implementation First, we need to know Ruby. If you don’t know how to install Ruby, First read this article.

Testing SASS

Let’s make sure everything is working. First, execute the following command:

sass -v

Output:

After execution, you can see the version of SASS installed on your system.

Now let’s try some actual SASS code. Fire up your editor and create a new file named style.scss.

Enter the following code, and save the file.

$primary_color : #000000;

body {
  text-color: $primary_color;
}

Now go back to your command prompt window, make sure you’re in the folder where you created the file, and execute the following command:

sass style.scss style.css

Output:

The SASS transpiler will create the style.css file in the folder named css. If you open it in your editor, it should look like this:

body {
  text-color: #000000;
}

Congratulations! You have just written your first piece of SASS code and transpiled it into CSS.

Footer Logo

Subscribe

Select Categories