Introduction
By now, you will know that the code of CSS files for complex websites becomes very lengthy and complicated, so to solve this problem, we are using Sass but have you ever wondered how to install Sass in your machine and how to use it?
While moving further in the blog, we will answer all your questions, whether they are regarding installation or usage. So without wasting any further time, let’s move with our blog.
Installation of Sass
Sass is a more stable and powerful tool that uses CSS to provide basic language power. Before using Sass directly, you should install it on your local machine.
System Requirements for Sass
Here we will discuss the system requirements and browsers on which Sass will work properly.
- Operating System - Cross-platform.
- Browser Support - Google Chrome, Firefox, Safari, Internet Explorer(8+), Opera.
- Programming Language - Ruby
First, we will see how to install Sass on Ruby, which means installing Ruby.
Installation of Ruby
Step1 - Open the official ruby website link. From it, download the latest stable version in zip file format.
Step2 - Now run and install the setup to install Ruby on the System.
Step3 - Now we have to add the Ruby folder to the path of our local machine. We have to add it in both User Variables and System Variable in the path.
Path User Variable -
- Right-click on the My Computer icon.
- Select Properties.
- Now click the Advanced tab and then click Environment variable.
Now click the Environment Variables button, and in this Double click on the path, the screenshot is given below:
Now you will see an Edit User Variable box. Add the bin folder path in Variable Value as C:/Ruby/bin. Then click the OK button.
System Variable
Now, after clicking the Environment Variable button. There appears the System Variable portion like this:
Click on the new button, and after clicking, there appears a New system Variable block as shown in the image below:
Fill rubygems in Variable value and RubyOpt in Variable name. After filling in the details, click on OK.
Step 4 - Open the command prompt on your computer and add the following command:
gem install sass
Step 5 - After installing Sass, you will see the following screen.
These are the steps to install Ruby on your System.
Install Anywhere(Standalone)
Now we will see some basic commands to install Sass on any operating system.
Installing Sass in Node.js
In node.js, you can install Sass by using npm instruction:
npm install -g Sass
But this will install only the JavaScript application of Sass. It will be slower than the original one that we have installed above.
Install on Windows
You can install Dart Sass in windows, chocolatey Package manager, by running the following command:
choco install Sass
Install on Linux (Homebrew) or Mac OS X
If you are using Homebrew package manager for Linux or Mac OS X, you can install Dart Sass by running the following command:
brew install sass/sass/sass