-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Sass and Compass Designer's Cookbook
By :
When you start using frameworks, such as Bootstrap and Foundation, as discussed further on in this book, you will also start using variables for customization. The usage of the !default keyword when declaring the framework's variables makes it possible to customize the code without changing the original code. Keeping the original code untouched enables you to update the framework source code without destroying your modifications.
Install Ruby Sass as described in the Installing Sass for command line usage recipe of Chapter 1, Getting Started with Sass. You can edit the SCSS code of this recipe with a text editor.
The following steps will show you how to use the !default operator when declaring variables:
Create a Sass template called default.scss and write down the following SCSS code into this file:
// scss-lint:disable ColorKeyword
$color: red;
$color: green !default;
.green {
color: $color;
}Now run the following command...
Change the font size
Change margin width
Change background colour