Update: see my updated post with details of a newer, better solution.

If you’re like me, you’re probably already playing around with the Rails 3.1 release candidate. If not, go take a peek at why you should be excited. (Thanks Ryan Bates!) If so, like me, you’re probably also wanting to play with all your old friends, like Compass.

Compass, by default, manages SASS for you. It gives you a place to put it, app/stylesheets, and takes care of bundling everything together. The new Rails 3.1 asset pipeline does this all for you using Sprockets instead, and does it nice and cleanly in a consistent manner with CoffeeScript and whatever else you might eventually integrate.

The problem is, I don’t want Compass managing my SASS. I like love the asset pipeline. But by default, from the asset pipeline I can’t use Compass. It doesn’t know what or where it is. So, I’ve added this to my new rails 3.1 projects:

Can’t see this Gist? View it on Github!

I’m also a heathen and like SASS, not SCSS, and it took me a minute to realise that it’s just as easy to use. Instead of mystyle.css.scss, name your stylesheet mystyle.css.sass. To make rails do this by default when you’re generating controllers et al, add this into your config/application.rb‘s config section:

Can’t see this Gist? View it on Github!

You can even rename the default application.css to application.css.sass and all the sprockets require_* machinery still works. Make sure you change the /* ... */ comments to // comments.

Beauty!