CSS was created to make the web beautiful and responsive. However, working with CSS can be complex, especially when writing standard CSS to build responsive designs based on a device's screen width, height, orientation, and other factors.
As simple as it may seem, CSS comes with challenges and limitations. It doesn’t support logic, which means that for more dynamic styling, additional tools are required.
There are tools created to extend the functionality of CSS, an example of these tools are CSS preprocessors.
Preprocessors add features to simplify code and enhance the process of development. There are different types of CSS pre-processors such as SASS, LESS STYLUS, POSTCSS and CLAY, etc.
In this article we’ll discuss the commonly used pre-processor called SASS (syntactically awesome style sheets) and also examine its syntax options SASS and SCSS.
Before we proceed, let’s understand what CSS processors really are and how they work.
What is CSS Preprocessors?
CSS preprocessors are scripting languages that allow developers to use logic in their CSS code such as variables, functions, nesting, inheritance, mixins, etc.
They extend the default capabilities of standard CSS making it easy to automate repetitive tasks like defining colours and values that can be reused throughout the style sheet.
Common features of CSS preprocessor include;
Variable: Allows you to store and reuse values like font-size, colour, throughout the stylesheet.
Nesting: Allows you to write CSS rules inside other rules to reflect HTML structure or match the Hierarchy of your HTML.
Mixins: Allows you to create blocks of CSS code to define complex styles that can be reused throughout the stylesheet.
Functions: Allows you to perform calculations and also manipulate values within CSS.
Partial and Imports: Allows you to break the stylesheet into smaller, modular components for organisation and reusability.
We’ll explore these features more as the article progresses.
To work with a CSS preprocessor, first, you need to install the tool on your computer or server. Next, you write your styles using features like nesting.
Then the tool converts these styles into standard CSS that the browser understands and finally the CSS is displayed on your webpage.
Now that we’ve seen what CSS preprocessors are about, let’s take a look at the one in particular called SASS.























