I’ve been working on a small Rails 4 app. I had finally made enough progress that it was time to get Allan involved. He’s a big fan of Compass and found a bug that he couldn’t figure out almost as soon as he started.
When changed the .css.sass file with below code snipped the error happened.
@import compass
At first this seems like a pathing issue, but a quick google search shows that Compass doesn’t support Rails 4 yet. A lot of people reported that it was working for them and had little hacks here and there, but none of them worked for me. (The most significant hack was to use a different branch, more on that below.) Finally we decided to migrate our Rails 4 app to Rails 3. It didn’t take that long to do (not a lot of new things in Rails 4), but to my horror I had the same error in Rails 3. This made me think perhaps it was something in my app, so I made a fresh Rails 4 app and it worked. Obviously I went one step at a time until I traced the source of the problem: Don’t put the gem declaration in the assets group of your gem file. Boom, it works. You also have to use the “rails4-hack” branch of the gem.
gem "haml-rails"
gem 'sass-rails'
gem 'compass-rails', github: "Compass/compass-rails", branch: "rails4-hack"
group :assets do
end
One last note: The Compass lib files are stored in RAILS_ROOT/tmp/cache/assets. This means it’s possible for you to have everything working, then have a developer come alone and move the gem declaration into the assets group, and have everything keep working. Until deploy time, a new developer comes on the project, or someone clears tmp, then boom!
Also thanks to Chris Your of Ignition Industries for giving us some assistance via Twitter.
If you wanted it to build a product you’d find a way to get time to work on it. If you really wanted to start that new hobby you’d sacrifice something to find the time and money to do it.
I'll define a "Wannabe Entrepreneur" as someone who has never made money from their businesses. Here are the different types of wannabes.
In the past few years I've built go-carts, built a 200+ sq ft workshop, written several eBooks. How do I create a life where I have time to work on side projects?
Get actionable tips on making life as a business owner easier. We've been in business 8 years and we're still learning too!