-
Book Overview & Buying
-
Table Of Contents
Mastering Responsive Web Design
By :
Knowing how Sass works is a matter of understanding several basic technological concepts:
book-styles.scss. When it detects a change in that SCSS file, it then compiles it into a CSS file book-styles.css.Watching an SCSS file means that the Sass watcher is running in the background looking over the SCSS file(s) for any changes.
Here are the steps we're going to follow:
Windows: Download the Ruby installer from the following link:
http://rubyinstaller.org/downloads/
Mac: Ruby comes preinstalled on all Macs, so there's no need to download anything.
Windows and Mac: Open the command line.
Windows Tip!
Press Windows + R, type CMD, and then press Enter.

Type the following command into the command prompt (it doesn't matter which folder you're in):
Windows, use the following command:
gem install sass
Mac, use the following command:
sudo gem install sass

It'll take a few seconds to install Sass.
At the time of writing, the latest version of Sass was 3.4.14. The version/revisions might be different by the time the book comes out.
That's it! Sass is now installed on your machine.
What I'm about to show you is completely different to what any other Sass tutorial out there tells you to do. Most of those tutorials complicate things too much. This is the simplest way to use Sass you'll ever read.
The following screenshots are on Windows, but the process can be applied exactly the same regardless of platform.
In the following steps, you will see examples of how the necessary folders and files look after being created, not how to create them:
/Demo folder anywhere on your drive:
/css and /scss:
.scss file. Go into the /scss folder and create a file called styles.scss:
Notice the file extension .scss? This is your Sass file. Yes, right now there's nothing in it, it's empty.
cd <space>cd means Change Directory. From your file manager, drag and drop the /Demo folder into the command prompt/terminal window and press Enter.
/Demo folder now.
/scss and /css folders by typing this in the command line:sass --watch scss:css
/scss and /css folders.
That's it! You are now using Sass!
The --watch flag tells Sass to pay attention to the /scss and /css folders so that when we make a change to a .scss file (in our case, styles.scss), Sass will detect the change and compile the SCSS into the final CSS file we're going to use in our website or app.
.scss file and watch Sass compile it into a .css file:styles.scss file.styles.scss file.styles.css file and enjoy your new creation.
Change the font size
Change margin width
Change background colour