Before we dive into mastering responsive web design, we need to be on the same page as far as technologies go, in our case, CSS preprocessors and, specifically, Sass.
In this book, all CSS is going to be written in Sass in SCSS format. The way we write CSS has changed; it has improved tremendously.
CSS preprocessors such as Sass, LESS, and Stylus give the web/mobile designers and developers new superpowers. Yes, I used the word superpowers because that's exactly how I felt only a few hours after using Sass for the first time, and what I used was as basic as it gets:
.navigation-bar {
display: flex;
li {
padding: 5px 10px;
}
}See the nested li selector? Yeah, that's Sass in action. When the preceding code is compiled, this is what it looks like:
.navigation-bar {
display: flex;
}
.navigation-bar li {
padding: 5px 10px;
}Downloading the example code
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Let's see what's in store for us in this chapter:
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.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.
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:

/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!
.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.