Using Compass with Rails 3.1 final and no hacks

The web is full of complicated instructions about getting the Compass CSS framework to work with Rails 3.1 & the asset pipeline when actually you don’t need to do anything any more.

All you need to do, is add Compass to your Gemfile and you should be all set. You can even group it under assets (so long as you precompile assets before deploying).

But you might find it still doesn’t work, that’s because the stable version of Compass (0.11) doesn’t work with Rails 3.1. So you need to explicitly request version 0.12:

group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
  gem 'compass', '~> 0.12.alpha'

Now you can carry on using the great Rails 3.1 asset pipeline with all the Compass and Blueprint mix-ins you want.

This entry was posted in Blog, Ruby. Bookmark the permalink.