Dude, get into sass!

Dima

I found out that many hesitate to learn sass. Internet is full of guides with complicated instruction for über super editors and SDK. They just ruin an idea of easier approaching and spreading this lovely invention.

So if you are one of those hesitators, dude, throw away all thought you have about sass or scss. Especially if you think that it’ll take too long to learn or it requires odd apps. Nope! Don’t waste your time any more. The only thing you need is a compiler. You still can use a code editor you love.

Sass/scss itself is quite simple. Sass is kind of Ruby style coding and scss is more like css. I prefer scss, because I like that it is visually the same as css. And it also suitable for my brain to process quickly 😛

In web developing I use Notepad++ on Windows and BBEdit on Mac. I’ve chosen them, because of their best, IMO, solution for editing over ssh connection to the servers. And their GUI is so lovely minimalistic.

But stuff you want to know is Koala. The simplest, freest and cross-platformiest compiler you’ll ever find. Sure there is many other apps and ways to compile. But Koala is best to start from or to stick with for entire life. Did I say that it is free? Still, it would be better to donate something to developers as you are a developer yourself. Aren’t you?

Just drop folder, containing scss files, into Koala and you are done 😉 Just write something in scss and save in .scss extension and Koala compiles it automatically to .css. Later you can little by little get familiar with Koala’s settings. There is only a few 😉

You can keep both .scss and .css files open in editor’s split-screen and see compiled results almost in real-time. In Notepad++ you can manually reload file by adding some short keys to Reload or use Document Monitor plugin that reloads changed files automatically in 3sec intervals.

But if you are very familiar with Linux and used to edit files over ssh connection. You probably think how to compile files on the server. The simplest way is to use Ruby based Sass compiler.

Make sure that ruby is installed and then type gem install sass and sass compiler will be installed. Finally just go to the directory where you see both scss and css folders and type sass --watch scss:css -t compressed --sourcemap=none And it will automatically watch for changes in scss folder and compile everything into css folder. -t compressed parameter will compress your css file. See more options by typing sass -h.

And now I yell that you’ll learn scss in 5 seconds. Ready?

$mycolor: red;
.header { color: $mycolor; }

A compiled result will be .header { color: red; }

You have just learnt how to create a variable and use it in css!

The very best place to learn sass and scss basics just in few minutes is Sass: Syntactically Awesome Style Sheets

More nuances of sass you find there The Sass Way

Think again and enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *