Codementor Events

[Sass] For Beginners: The Friendliest Guide About INSTALLING and USING Sass on Windows

Published Oct 04, 2017Last updated Jun 05, 2019
[Sass] For Beginners: The Friendliest Guide About INSTALLING and USING Sass on Windows

The simplest and most detailed guide about how to install and use Sass you’ll ever read!

Before You Start Reading:

If you’re a beginner in Sass, this detailed tutorial is for you. I really hope you enjoy it, I spent a few days working on it to create a compelling and useful message.

Please give it a Like if you found it useful 😊  — Thanks!


UPDATE 5/30/19 — Ruby Sass is no longer recommended to use

This guide was initially created for the old Ruby Sass. However, as of March 26th, 2019 Ruby Sass has reached end-of-life, in other words, Sass developers will no longer create new features, support or maintain the Sass version based on Ruby.

Dart Sass is now the standard.

With this being said, Ruby Sass still works and will continue to work as-is. So if you decide to install Ruby Sass, you can. You will, however, get a message in the CMD stating that Ruby Sass reached end-of-life:

Screenshot - 5_30_2019 , 8_05_24 PM.png
Message in the CMD stating that Ruby Sass has reached end-of-life.

I am leaving this installation guide for Ruby Sass for posterity and reference.

HUGE THANKS to all of you that clapped and commented about how this guide helped you installing and using the old Ruby Sass on Windows🙏.

Read the official news of Ruby Sass reaching end-of-life here: http://sass.logdown.com/posts/7828841

What do I do now then? 🤨

The best way is to simply forget the CMD altogether and use an application to compile your Sass files into CSS.

The two applications on Windows I recommend are:

  1. Prepros — https://prepros.io/ (Free, or $29 at the moment of writing this update)
    This is the one I personally use. I’ve been using it for several years now and it works beautifully. And no, this is not an advertisement for Prepros, I’m not an affiliate of the developer. In other words, I don’t get any money if you buy it, lol. However, you don’t HAVE to purchase it at all to use it. All its features are available with its Free Unlimited Trial.
  2. Koala — http://koala-app.com/ (Free)
    I’ve used Koala before, and it has worked great for me. It’s very lightweight and a bit simpler to use than Prepros.

What makes this guide different?

I remember almost 5 years ago (today being 10/3/2017) I looked all over the web for a simple guide, with simple steps, in “human” language to help me install Sass. There was NOTHING. Well, actually there was this one website (I can’t even find it now anymore) that had a very, very rough list of how to do it, but yet it was the ‘friendliest’ of everything else I came across.

After trying to install Sass three times in a span of about 3-4 months, I was finally able to “crack the code”. Now, here I am showing you how to do it 😉.

So what makes this guide different from aaaaalll other guides out there? It’s different because I’m going to explain it to you the way I would’ve liked to have seen it explained to me back then, when I had no clue about command line crap (and I still don’t to be honest).

This is a:

A. Simple guide
B. With simple steps
C. In human language

Here we go 🚀!

Steps to Installing Sass on Windows (versions 7/8/10)

  1. Download the Ruby installer: http://rubyinstaller.org/downloads/ — Look for the version with (x64) on it.
    WTF is Ruby? 😕
    Ruby is the technology or programming language Sass is built on. So you need to install Ruby first so Sass can then run on top of it. 😌

  2. Open the Command Line (CMD)
    Tip!: Press Windows Key + R and type: CMD, then press Enter.
    The almighty Command Line (CMD) will appear:
    cmd1.png
    Command Line (CMD) in Windows

  3. Type the following command in the CMD (it doesn’t matter which folder you’re in):
    gem install sass
    cmd2.png
    Command to install Sass

WTF is a gem? 😕
A gem is piece of software or app made to run on Ruby. It’s like… installing an addon on Firefox or an extension on Chrome.

It’ll take a few seconds to install Sass. At the end you’ll see this (the Sass version is obviously different now though):

Successfully installed sass-3.3.7
1 gem installed
Installing ri documentation for sass-3.3.7…
Installing RDoc documentation for sass-3.3.7…

Here’s a screenshot of what you’ll see in the CMD:

cmd3.png
Result of successfully installing Sass

That’s it! Sass is now installed on your machine 🎉!


Yeah, I know it looks “doh!” and simple but believe me, there were no screenshots of anything back then and most of the installation tutorials were for Macs.

So hopefully someone can find these steps useful and clear as they need to be.


Check the “PATH” if you’re having issues executing Ruby

Sometimes, for some unknown reason, Ruby doesn’t get properly installed in your PATH. If this happens to you, check your PATH to make sure the folder to Ruby is listed there.

cmd4.png
Environment Variables dialog box in Windows showing the PATH to Ruby’s executable.

Don’t know what the PATH is? No problem, read this post I created exactly for this moment 😉: The effin’ PATH demystified (Windows).

…Or Reinstall Ruby

If you don’t know how to edit the PATH, relax. Just reinstall Ruby and make sure you have the ‘Add Ruby executables to your PATH’ option checked:

cmd5.png
Ruby installation wizard. Make sure the option ‘Add Ruby executables to your PATH’ is checked.


Steps to use Sass

Ok, what I’m about to show you is COMPLETELY different than what any other Sass tutorial out there tells you to do.

Why? Because most of those tutorials complicate things too much.

  1. Create a /Demo folder anywhere on your drive
    Like this:
    cmd6.png
    /Demo folder created in my hard drive.

  2. Inside that folder create two sub folders: /css and /scss
    Like this:
    cmd7.png
    /css and /scss folders.

  3. Create a .scss file
    Go into the **/scss ** folder and create a file called: demo-styles.scss
    Like this:
    cmd8.png
    demo-styles.scss file.
    Notice the file extension .scss? This is your Sass file 😊. And yes, right now there’s nothing in it, it’s empty.

  4. Go back to the CMD for a minute
    In the CMD you need to go to the /Demo folder.

Tip!: The easiest way to go the /Demo folder is by dragging & dropping from your file manager into the CMD window, like this:
cmd1.gif
Drag & drop the /Demo folder into the CMD.

I. In the CMD type: cd(space), yes, a space after “cd”. “cd” means Change Directory.
II. From your file manager drag & drop the /Demo folder into the CMD window.
III. Press Enter.
IV. You should be in the /Demo folder now.

Note: In my animated GIF above I used my Z: drive to create the /Demo folder, that’s why you see an extra step where I have to type ‘z: + Enter’ in order to go to that drive.

  1. Make Sass watch your SCSS files and make it compile the CSS
    Type the following in the CMD and Sass will “watch” your /scss and /css folders:
    sass --watch scss:css
    Like this:

cmd2.gif
Make Sass “watch” the /scss an /css folders.

That’s it. You are now using Sass 😁!

WTF is the “--watch” command 😕?
Actually, the “--watch” command is not a “command”. It’s called a flag.
The “--watch” flag tells Sass to “pay attention” to the folders /scss and /css, so when you make changes to the .scss file (demo-styles.scss) Sass will detect the change and compile the SCSS file into the final CSS file you’re going to use on your website or app
👍.

All tutorials I’ve read make you watch specific files, like this:
sass --watch styles.scss:styles.css

…which is Ok. I just think that watching folders is easier and makes more sense because you’re watching ALL FILES in both directories rather than specific ones, and saves you having to type too much in the CMD as well.

  1. Edit the .scss file and watch Sass compile it into a .css file
    Like this:

cmd4.gif
Sass compiling a .scss file to .css

I. Open your CSS editor (I use Sublime Text)
II. Open the file demo-styles.scss
III. Add some CSS to it
IV. Save the demo-styles.scss file
V. Verify in your CMD that the compiling was successful
VI. Open your demo-styles.css and enjoy your new creation

You now have leveled up by knowing how to use Sass 😉.

Note: As you can see I’m writing basic CSS, not Sass because what I’m trying to show you here is how the .css file is compiled.

How to check if Sass is installed?

Easy. Open a CMD, type this and press Enter:
sass -v

cmd9.png
Checking Sass version. This also tells you that Sass IS installed.

This is helpful when you open a new CMD window, or are checking on someone else’s machine that Sass IS installed and if so which version they have.

How to update Sass?

Easy again. CMD » type » Enter:
gem update sass

Note: I wish I was able to show you a screenshot of my CMD but I have already installed the latest version so the CMD only says “Nothing to update.”, lol. I will update this section when a new version comes out and I perform a gem update.


Final Words

Yeah, post a little longer than others but I think the clarity in the steps makes it worth it.

As far as how to write Sass, there are plenty of articles out there, I can recommend this one: Beginner Guides & Tutorials on Sass and Compass and this one: Getting Started with Sass.

If you’re interested in another ‘simple & friendly’ post about the pure basics of Sass, drop me a message.

Or if you still need help, same thing, drop me a message on Twitter, or my personal website, I’d be glad to help.

Thanks for reading 😎!

If you found this post valuable, don’t forget to Like it!

Thanks!

Ricardo.

—This tutorial was first published in my Medium.com blog.

Discover and read more posts from Ricardo Zea
get started
post comments23Replies
Helena
3 years ago

You said that dart sass is now the standard, so it would be cool if you could link to an equally beginner-friendly guide to how to use that :)

Ricardo Zea
3 years ago

Thank you for your note :)

As I mentioned above, “I am leaving this installation guide for Ruby Sass for posterity and reference.

Check out the “What do I do now then? 🤨” section in this article: https://www.codementor.io/@ricardozea/cjfs2id3o#what-do-i-do-now-then

Using one (or any other) compiling app, renders the creation of a Dart Sass tutorial unnecessary, especially since this guide is for beginners.

Trina Noakes
4 years ago

After hours of struggling with this, your article made it so easy! The step by step with screenshots saved me. Thank you so very much!

Ricardo Zea
4 years ago

I SO TOTALLY understand the feeling Trina! That’s why I wrote this article :). I’m very glad this article was able to help you and teach you at the same time.

Thank you for sharing your success :D

Dipali Singh
4 years ago

very well explained, keep writing such great content :)

Ricardo Zea
4 years ago

Thank you Dipali, glad to see it helped you as well :)

Show more replies