Ramiro Franco

Rails 3.1, Sass, Compass, and Comments.

Written on Tuesday January 17, 2012 at 3:27 p.m.

So I'm in the middle of upgrading one of the projects at my company from Rails 3, to Rails 3.1. An endeavor that I was very excited about. This means we'll be switching to the new rails 3.1 asset pipeline, which I've found very enjoyable in my own projects at home. There are a couple of issues I've encountered on the way though and thought I'd document them ( in case someone else is looking for a solution to a similar problem ).

One of these issues was that the current version of compass ( 0.11.7 ), actually changes the behavior of the image-url() tag in sass. Normally, this should generate a link to the dynamically compiled assets in /assets/, but with compass installed rails continues to point to /public/. I couldn't find any great documentation for the error, but did find someone asking about it in an obscure post in the sass github.

The other issue I ran into was that in my current configuration with rails 3.1.3, sass 3.1.12, and sprockets 2.0.3, adding /* this style */ comments to a sass file, after a line of code causes a "stack level too deep" error. It wouldn't have been so hard tracking this down as the problem if the same lines didn't also have complex linear-gradients which I had first assumed were the problem, since a post-line comment seemed much more benign.