How to use compass with rails 3.1

UPDATE: Seems like there is a better way !
Source: http://spin.atomicobject.com/2011/07/12/sass-sprockets-compass-with-rails-3-1/

UPDATE 2(dec 2, 2011): Chris Eppstein, creator of Compass posted this Github Gist of how to integrate Compass with Rails 3.1: https://gist.github.com/1184843

I now prefer this method over mine, as I noticed a great speed improvement at compilation time when using livereload.


MY METHOD:
(I now consider it deprecated, but maybe it can be useful in some cases, so here it is for reference:)

First, in your Gemfile, add:

gem "compass", "~> 0.12.alpha.0"

And don’t forget to execute a

bundle update

Then, in config/application.rb:

config.generators.stylesheet_engine = :sass

Rename application.css.scss to application.css.sass, or create it, and replace its contents by:

@import compass
@import _blueprint

(If you want to keep the new Rails 3.1 manifest code at the beginning of the stylesheet, you’ll have to replace the ‘/* */’ comments by the sass-syntax version ‘//’ at the beginning of each line)

Now, to test if compass and blueprint mixins work, add some code to the same file application.css.sass:

@import compass
@import _blueprint
body
  background: black
  +linear-gradient(color-stops(white, black))
  +column(5)

Run your rails server with

bundle exec rails server

Load your app in a browser, and visit http://localhost:3000/assets/application.css

If everything went well, you should see the compiled code.

Source:

http://blog.pixarea.com/2011/07/using-compass-blueprint-semantic-and-sass-syntax-in-rails-3-1/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)