5

For the most part I've followed the direction laid out here

Which is resulted in the following error coming from the initializer it asked me to create:

from /app/config/initializers/sass.rb:1:in `<top (required)>'
2011-09-05T16:45:42+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/railties-    3.1.0/lib/rails/railtie/configuration.rb:78:in `method_missing': undefined method `sass' for #  <Rails::Application::Configuration:0x00000003845528> (NoMethodError)

The Heroku page on getting started isn't much help either. It is basically the same instructions only without the initializer. However without it, then it can't find any of the blueprint stuff so I still can't start.

Anyone out there who has made it further than I have?

Edit for more history:

I went through a number of errors to get here so I figured I should write them all out. The first problem I had was that html5-boilerplate was in :assets which meant that the ie_html method wasn't found, so I pulled that out of :assets.

This resulted in this error because html5-boilerplate depends on compass:

2011-09-05T17:15:47+00:00 app[web.1]:    /app/vendor/bundle/ruby/1.9.1/bundler/gems/compass-b7f44a48d375/lib/compass/version.rb:56:in   `const_missing': uninitialized constant Compass::Frameworks (NameError)
2011-09-05T17:15:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bundler/gems/compass-html5-boilerplate-405f9ddbca56/lib/html5-boilerplate.rb:1:in `<top (required)>'

3 Answers 3

9

In the end the final solution was to also make sass-rails global (or at least it appears to have been). I sort of feel like I finally got this to work by co-incidence but here it is.

I pulled compass out of :assets and made it global too. Which then led to errors with compiling the SCSS files which finally led me to upgrade to Ceder which then resulted in the blueprint missing errors.

Lastly I added the initializer which, I assume, is meant to add the compass framework stuff to the config path. Hope that all helps.

Here is the relevant code:

gem 'heroku'
gem 'haml'
gem 'compass', :git => 'git://github.com/chriseppstein/compass.git'
gem 'html5-boilerplate', :git => 'git://github.com/sporkd/compass-html5-boilerplate.git'
gem 'sass-rails', "  ~> 3.1.0"

Note the github versions for compass and html5-boilerplate (you don't need h5bp if you don't use it).

The initializer is:

Rails.configuration.sass.tap do |config|
  config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
end
2
  • Having the same issue currently and moving sass-rails from assets to global doesn't appear to resolve it on my end... hopefully we can figure this out...
    – Pygmalion
    Sep 8, 2011 at 6:48
  • I should have been more detailed, I had to move a few things to be global, I've updated it. Sep 10, 2011 at 17:31
1

The issue isn't that sass-rails needs to be global, but that something in your global set relies on sass-rails.

For me, the solution was to move compass into the assets group.

4
  • Yes H5BP is called in the HAML base view and ended up needing to be global. It depends on Compass and that in turn depends on sass-rails. So it is a bit of a chain effect. Sep 13, 2011 at 18:02
  • How do you move compass into the assets group? What code needs to be changed?
    – Jaryl
    Sep 20, 2011 at 0:30
  • in your Gemfile: group :assets do gem 'sass-rails' end Sep 24, 2011 at 20:10
  • Moving compass to assets group solved it for me. Heroku now works normally and there's no difference on development machines. Nov 19, 2011 at 13:47
0

I've put some detailed instructions up here: http://www.mattvanhorn.com/2012/01/07/heroku-cedar-assets-ruby-1-9/

It covers getting a basic Rails 3.1 app with Compass framework running on Heroku Cedar stack.

There are also links to a github repo ( http://github.com/mattvanhorn/placepanda/commits ) so you can follow along step-by-step with the commits.

You might need to also add load_paths in application.rb if you're using blueprint. I use twitter bootstrap on another app like this, and I've got:

if Rails.configuration.respond_to?(:sass)
  config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
  config.sass.load_paths << "#{Gem.loaded_specs['compass_twitter_bootstrap'].full_gem_path}/lib/../stylesheets"
end

in my application.rb, the conditional is to prevent Heroku from barfing on startup, when config.sass will no longer be available as it is for pre-compile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.