Book Image

Sass and Compass Designer's Cookbook

By : Bass Jobsen, Stuart Robson
Book Image

Sass and Compass Designer's Cookbook

By: Bass Jobsen, Stuart Robson

Overview of this book

Sass and Compass Designer's Cookbook helps you to get most out of CSS3 and harness its benefits to create engaging and receptive applications. This book will help you develop faster and reduce the maintenance time for your web development projects by using Sass and Compass. You will learn how to use with CSS frameworks such as Bootstrap and Foundation and understand how to use other libraries of pre-built mixins. You will also learn setting up a development environment with Gulp. This book guides you through all the concepts and gives you practical examples for full understanding.
Table of Contents (23 chapters)
Sass and Compass Designer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Explaining the main.css.scss file


The Ruby on Rails setup compiles all the .scss files into CSS by default. In this recipe, you will learn how to organize your Sass files for code reuse and meeting the Don't Repeat Yourself (DRY) methodology.

Getting ready

Read the Hello world with Ruby on Rails recipe of this chapter to find out how to setup a Ruby on Rails web application.

How to do it...

The following step demonstrate you how to organize the Sass files of your RoR app to develop your CSS code DRY:

  1. Repeat all the steps of the Hello world with Ruby on Rails recipe or copy the recipe1 folder to the recipe2 folder.

  2. Then rename the app/assets/stylesheets/application.css file to app/assets/stylesheets/application.scss.

  3. Remove the content of the app/assets/stylesheets/application.scss file and write the following line of SCSS code into it:

    @import 'headers';
  4. Create a new partial file called app/assets/stylesheets/_headers.scss and write down the SCSS code shown here into it:

     h1 {
      color: #f00; //red...