What is SASS, and Why Should You be Using it

Before I tell you a bit about Sass and what it is I want to start off by saying that there are a decent number of people out there who think that Sass is bad and I just want to address that mindset first. Many of the problems that people have with Sass are actually problems with the way that people use it and not the language itself. This article isn’t about the problems that Sass does or doesn’t have but I think it's only fair I make you aware of the skepticism around it so you can dive into that deeper if you're interested.

Now, what is Sass? Sass is a CSS preprocessor language. A preprocessor means that the code you write in Sass is compiled into CSS before being sent to the browser to be interpreted. In other words, the browser doesn't understand Sass and still only interpreting CSS, but Sass is just a more efficient way to write that CSS. Let’s look at some of the things that Sass does.

First, and maybe the most common feature is that it allows the use of variables. I find myself using this feature a lot, especially for colors. Hex colors can be hard to remember and repeat, and it's easy to end up searching through your code to find colors used somewhere just to use it again. Even worse what happens if you decide to switch a color used all over your code. Sure you could ctrl + f and find every instance but it's definitely better if you can just change one line of code — your variable.

Next, let's talk about some other cool things, modules and mixins. The premise of both of these features is to reduce the amount of repeated code, by allowing sections of code to be reused.

I think that Sass is a powerful tool for developers and is one worth learning. If you're interested in diving deeper into sass take a look at the official page here: https://sass-lang.com/.

Student at Flatiron School