Thanks, Chris Eppstein! I think this is a great idea. This is a simple idea that I think should be applied for other languages/projects.

Using hassle gem for a happy Heroku/Sass marriage

I love Sass… there I said it. Go on tell my how much Sass sucks, I don’t care. I’ve been using it and have been in a happy code/developer relationship for quite some time now.

However there has been some hardship between Sass and I after trying to deploy my application to Heroku. The problem lies in that Heroku does not allow filesystem write access to anywhere but the temp directory. In a standard Rails application you would be putting your sass files in public/stylesheets/sass/, which would compile to public/stylesheets. This makes your app angry, APPLICATION SMASH.. ARGHHH.

So now that you have some background, have you run into this too? Yes… I thought so. Well it just so happens that I’ve got the cure for what ails you. Actually not me, more like this guy. It’s called Hassle and long story short, it is a gem/plugin that rewrites where your Sass files are compiled/served. You don’t have to do anything but install it.

Add this to your Gemfile and you’re pretty much done:

gem 'hassle'

Whoops! If you’re running a rails 3 app then you’re probably real mad at me right now. Well that’s what you get for not finishing my article. Don’t let it happen again! I forgive you.

Turns out that the straight up gem is not rails 3 ready as of yet, and totally hoses your app. Alas there is a lovely fork that provides the nurturing that I require.

gem 'hassle', :git => https://github.com/Papipo/hassle

So there you have it! Your Sass files are now written and served to/from /tmp which is a writable directory in Heroku. All of a sudden everyone is playing nice, hooray.

Just an FYI, some of the statements made in this article are fact and some are completely fabricated… believe what you will. The truth is out there.