maandag 4 augustus 2014

5 reasons you should be using Sass today

thumbnailBy now I’m sure you’ve heard of Sass and how “You really need to start using it!”


Learning a new tool can suck and finding the time to do so is next to impossible but sometimes a tool comes along that changes our industry and is too good to ignore.


As our web pages and apps get more complex our style sheets get larger and harder to maintain. CSS preprocessors like Sass help by keeping our style sheets concise and allowing us to modularize our code while offering a whole slew of features not yet available in regular CSS.


These extra features also make them really fun to use! Now you may have seen something that looks like this:


$i: 6;
@while $i > 0 .item-#$i width: 2em * $i; $i: $i - 2;
// http://sass-lang.com/documentation/file.SASS_REFERENCE.html#_11

and thought, “Whatttttttttttt? Thanks but I’ll keep my regular ol’ CSS.”


I admit, it looks daunting and some people are doing some really crazy, complex stuff with Sass but I’m here to tell you that anyone can start using it and the gains you get on day one will make you a Sass believer.


Getting Sass set up for a project is a little beyond the scope of this article but installation is relatively easy and the Sass website has instructions for Linux, Mac or PC. The cool thing is, once it’s installed, you can take any CSS file you have and rename it .scss making it it a Sass file.


All properly formatted CSS is valid Sass!


This means you can start using Sass while continuing to write your styles as you always have, slowly incorporating more features as your comfort level grows. That’s right folks, just the same ol’. same ol’ but here are five awesome gains you now have at your disposal: