8. group :assets do
gem 'sass-rails' # if running rails 3.1 or greater
gem 'compass-rails'
end
In your project directory run:
$ bundle
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
9. Rename your application.css to
application.css.scss and add to the file:
@import "compass"
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
- Extension of CSS3 that adds features that programming languages have - Make it easier to write and manage CSS - Interpreter translates Sass into CSS
2 acceptable syntaxes with 2 file types: - Indented syntax(.sass) - Similar to Haml - SCSS Uses CSS semantics, so CSS is valid SCSS (I'll be using this in the demo)
- Sass interpreter spits out css files from sass files - Automatic with rails and Sass gem - Also has a watcher that can look for updates to sass files and automatically generate .css
- Variables allow you to set a value in one place - Nesting organizes styles and saves you from typing our classes or selectors over and over - Mixins
- Open-source CSS framework - Uses Sass to provide mixins that solve common problems encountered when creating CSS files