New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass::Rails::Resolver not found on heroku #105

Closed
RalphAtHamburg opened this Issue Jan 8, 2015 · 22 comments

Comments

Projects
None yet
5 participants
@RalphAtHamburg

RalphAtHamburg commented Jan 8, 2015

After updating to rails 4.2 , sass-rails 5.1, compass 1.01 (via compas-rails) deploying to heroku causes the following error:

rake aborted!
     NameError: uninitialized constant Sass::Rails::Resolver
     (in /tmp/build_a38d96060def891adae51ce05faf5635/app/assets/stylesheets/styleguide.html.lsg)
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/livingstyleguide-1.2.1/lib/livingstyleguide/tilt_template.rb:44:in `sass_options'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/livingstyleguide-1.2.1/lib/livingstyleguide/tilt_template.rb:94:in `render_living_style_guide'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/livingstyleguide-1.2.1/lib/livingstyleguide/tilt_template.rb:16:in `evaluate'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/non-stupid-digest-assets-1.0.4/lib/non-stupid-digest-assets.rb:31:in `compile_with_non_digest'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
     /tmp/build_a38d96060def891adae51ce05faf5635/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'

The local development environment works fine. Maybe it’s something with compass. Commenting out "@import compass" in application.css.scss shows the same error in the development environment.

@hagenburger hagenburger added the bug label Jan 8, 2015

@kangguru

This comment has been minimized.

kangguru commented Jan 9, 2015

looks like this is coming from 59c7724 as theres no Resolver in sass-rails since... downgrading to 1.2.0 helps :)

@hagenburger

This comment has been minimized.

Member

hagenburger commented Jan 9, 2015

@kangguru thanks for pointing that out! Do you maybe have a fix for that? I’m not working with any Rails 4.x right now.

@RalphAtHamburg

This comment has been minimized.

RalphAtHamburg commented Jan 14, 2015

Just found some time have a closer look at this issue. The problem wasn't the move from rails 4.1 -> 4.2. As @kangguru mentioned its coming from 59c7724 Reverting the changes solves the error. I am wondering if we can revoke this commit?

@hagenburger

This comment has been minimized.

Member

hagenburger commented Jan 14, 2015

I would suggest we need some test cases. @derfred could you join the discussion?

@derfred

This comment has been minimized.

Contributor

derfred commented Jan 14, 2015

ok I'll look into it. My change was due to using image-path which failed in the precompile step. The lookup here (hence the Resolver class) must have changed.

I won't be able to do this today, but definitely this week.

@kangguru

This comment has been minimized.

kangguru commented Jan 14, 2015

yea. somthing has been changed there. first step should be to extend the check existence of Sass::Rails::Resolver but is seems like we need to come up with something for sass-rails > 3.x

@derfred where did you use image-path? in a stylesheet or the styleguide

@derfred

This comment has been minimized.

Contributor

derfred commented Jan 14, 2015

@kangguru in a stylesheet. I only tried it in a Rails 3.2 app with sass-rails 3.2.5.

@RalphAtHamburg

This comment has been minimized.

RalphAtHamburg commented Jan 14, 2015

This commit removes the resolver rails/sass-rails@d357b01

@derfred

This comment has been minimized.

Contributor

derfred commented Jan 14, 2015

Please check #106.

So here's the story: In sass-rails < 4.0 the asset path helpers like image-url were implemented in sass-rails with the help of the Resolver class. In 4.0 those helpers delegate to sprockets. Now in 5.0 the resolver which was no longer used is removed.

@kangguru I think just extending the existence check like I did in my pull request is sufficient. I tested the following combinations:

  • rails 3.2.21, sass-rails 3.2.6, sprockets 2.2.3
  • rails 4.0.1, sass-rails 5.0.1, sprockets 2.12.3
  • rails 4.1.6, sass-rails 5.0.1, sprockets 2.12.3

They all work and do the right thing, ie embed the correct asset url.

@kangguru

This comment has been minimized.

kangguru commented Jan 14, 2015

cool thing! thx for the effort to check it out on different versions of sass-rails

@hagenburger

This comment has been minimized.

Member

hagenburger commented Jan 14, 2015

Thank you, awesome! :)

@kangguru @RalphAtHamburg would you mind testing it before I release?

@kangguru

This comment has been minimized.

kangguru commented Jan 15, 2015

works for me :) as far as i can tell.

this is something i have in my stylesheet:

&.as-mobile
    +retina-background(image-path('leistungen_mobile.jpg'), image-path('leistungen_mobile@2x.jpg'))

this is how i use it in the styleguide

%li
  .a-hero-list-box.as-mobile
    .a-hero-list-box--title Mobile Foo

yields no error. @derfred this the usecase when you encountered the issue, correct?

@derfred

This comment has been minimized.

Contributor

derfred commented Jan 15, 2015

@kangguru yes that was my exact use case.

@RalphAtHamburg

This comment has been minimized.

RalphAtHamburg commented Jan 15, 2015

works for me:

  • rails 4.2, sass-rails 5.0.1, sprockets 2.12.3
@kangguru

This comment has been minimized.

kangguru commented Jan 15, 2015

\o/

@ghost

This comment has been minimized.

ghost commented Jan 20, 2015

i'm using rails 4.1.6, sass-rails 5.0.1, sprockets 2.12.3 but still got uninitialized constant Sass::Rails::Resolver it seem **Sass::Rails::Resolver"" only exist in sass-rails >= 3.x

@kangguru

This comment has been minimized.

kangguru commented Jan 20, 2015

hm, are you using the correct reference in your Gemfile?

https://github.com/konvenit/livingstyleguide/tree/fix_the_fix_of_the_fix

this fix isn't yet in hagenburger/master

@hagenburger

This comment has been minimized.

Member

hagenburger commented Jan 20, 2015

I’ll prepare a release right now :)

@hagenburger

This comment has been minimized.

Member

hagenburger commented Jan 20, 2015

@hagenburger

This comment has been minimized.

Member

hagenburger commented Feb 8, 2015

I had a deep look into sprockets, sprockets-rails, sass-rails, tilt, and middleman which led into a complete refactoring. Having the new code, LSG should render Sass exactly the same way Rails/Middleman does and provide access to all helpers and load paths. The fix for this issue should be obsolete. But it needs to be tested with different Rails version combinations.

This will be available from 2.0.0.alpha.3 on.

@RalphAtHamburg

This comment has been minimized.

RalphAtHamburg commented Feb 9, 2015

I just started porting the desksurfing LGS to the new LSG2 style, so we will have it tested on Rails 4.2 (ruby 2.2)

@hagenburger

This comment has been minimized.

Member

hagenburger commented Feb 9, 2015

@RalphAtHamburg looking forward to hear your experiences!

hagenburger added a commit that referenced this issue Nov 5, 2015

Merge pull request #106 from konvenit/fix_the_fix_of_the_fix
fix breakage with sass-rails > 5.0 (see #105)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment