Getting Started with Sass – Learning the Basics and Its Installation

Perhaps you already heard about Sass (Syntactically Awesome StyleSheets) and you are interested in it, but don’t have an idea about how to set it up or incorporate it into your project. In the most basic form, Sass is known as the CCS processor, which makes it possible for the CCS writing to become more proficient and quicker. We will go over about the basics and installations of Sass for both Mac and Windows.

The Basic Learning about Sass

There are a few learning curves when it comes to the use and setup of Sass. In order for you to move forward with the Sass project, you need to have at least basic knowledge of HTML and CSS. You need to be proficient or competent with the CSS before you try to learn CSS processor, which is the Sass.

If you have ever changed the colors in your stylesheet a lot of time or wished there is a better way, or had already your stylesheet covered with the vendor prefixes, or had noticed that your stylesheets was longer and are hard to maintain, perhaps those reasons were enough to offer studying Sass a go. I will be summing up few of the terms do you can understand the basics of Sass.

  • Variable – it is a storage container for the CSS value like numbers and colors. The syntax was written as “$variable”. This code can be used in the entire stylesheet after you defined it.
  • Nesting – it reduces the repetition in the code and it has the ability to make the CSS writing easier and faster.
  • Partials – these are the CSS files beginning with the underscore “_partial.scss” and they are not compiled on their own CSS files but imported to the main file.
  • Import – use “@import” in order to compile all partials in a single file.
  • Mixins – use “@mixin” for the repetitious CSS, like when the vendor prefixes were required.
  • Extend – use “@extend” in order to change few aspects of the key of otherwise elements of the same identity, such as a group of buttons having different colors.
  • Operators – this allows the user to use mathematical calculations in the CSS, like defining the width of different parts of the layouts.

Installing Sass in Mac and Windows

Sass is running on the programming language of Ruby, thus Ruby needs to be installed on your computer. For Mac users, Ruby is already preinstalled on the OSX. Check in order to ensure you are running updated version by typing “ruby – v”. If the number is lower than 2.0.0, then type “do gem install ruby” to update. Now you can begin installing Sass.

However, in Windows, the installation is a bit trickier because it has no Ruby installed. If you run a 64-bit version of a Windows 7, choose Ruby 2.1.7 (x54). The Same thing must also be done for Windows 8 and 10. Make sure to choose “Add Ruby executable into your PATH” then continue. Once Ruby is installed, open the Command Prompt and then confirm that Ruby was installed. Then you can install Sass by typing “gem install sass” and you’re set.

RailsCarma has been working on Ruby on Rails framework from its nascent stage and has handled over 250 RoR projects. Check out our portfolio to understand how we are helping to change the shape of software industry by providing Ruby on Rails Developer. Get in touch with us now!