Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Ben Os
Ben Os
20,008 Points

I took the the first scection of the "Saas basics" course and something wasn't clear to me

When Hampton wrote the Saas code, it seemed to me almost identical in length to the CSS code...

Till I tried the course, I was sure that Saas can do everything that CSS can do but in much less code... Was I wrong? Is Saas only an expansion with some different natural behavior (like nesting) but the code amount remains basically the same ?


1 Answer

David Bath
David Bath
25,940 Points

I would say rather that Sass can do everything that CSS can do but with less effort, not necessarily more or less code. It is possible to write Sass code that will output a greater or less amount of CSS (depending on how it is written), but that isn't really the point of Sass. It can make CSS coding easier to write, but more importantly in my opinion, it can be much easier for organizing your code. This is very very important when you are writing large amounts of CSS, such as for a very large website or web application. A small example: being able to keep all of your color variables in a single separate file, which then be referenced from any other .scss file in the application. Need to change one of the colors in your color palette? You only need to change it in one place. Or swap all the colors out for a different color scheme.

Going back to the amount of code, since Sass supports things like looping, it is possible in some cases to generate a large amount of CSS with very little Sass code. Also, the use of mixins allows you to very easily include any number of different styles into any class that uses that mixin. So in these cases the Sass code you write will be less than the length of the output CSS.