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

Already on GitHub? Sign in to your account

uninitialized constant Sass::Rails::Compressor #111

Closed
schnittchen opened this Issue Jun 15, 2012 · 16 comments

Comments

Projects
None yet

I tried to work around issue #109 when I hit this. Note I use

config.assets.css_compressor = :uglifier

with sass-rails from current 3-2-stable as

gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git', :ref => 'bdfeb7ba71eae9ab0b214190319e109bbb0a9fe7'

Here's what happens:

RAILS_ENV=production bundle exec rake --trace assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from <top (required)> at /Users/thomas/my_rails_app/config/application.rb:15)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /Users/thomas/my_rails_app/Rakefile:8)
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
uninitialized constant Sass::Rails::Compressor
  (in /Users/thomas/my_rails_app/app/assets/stylesheets/admin.css.sass)
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/inflector/methods.rb:226:in `block in constantize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/inflector/methods.rb:225:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/inflector/methods.rb:225:in `constantize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.0/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/compressors.rb:22:in `registered_css_compressor'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/bootstrap.rb:22:in `block in run'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/compressors.rb:80:in `call'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/compressors.rb:80:in `compressor'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/compressors.rb:74:in `compress'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/processing.rb:243:in `block in css_compressor='
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/processor.rb:29:in `call'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/processor.rb:29:in `evaluate'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:177:in `block in evaluate'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `evaluate'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/bundled_asset.rb:26:in `initialize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:in `new'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:in `build_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/static_compiler.rb:20:in `block in compile'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:in `block in each_logical_path'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each_entry'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:in `block in each_file'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each_file'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in `each_logical_path'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/assets.rake:52:in `internal_precompile'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/assets.rake:66:in `block (3 levels) in <top (required)>'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/thomas/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.0/lib/sprockets/assets.rake:56:in `block (3 levels) in <top (required)>'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/thomas/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `load'
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile:primary

bndn commented Sep 30, 2012

It's not related to the last version of sass-rails. This problem happens to me with sass-rails 3.2.0 and sass 3.1.12.
I don’t know why the default CSS compressor defined in Sprockets is Sass::Rails::Compressor while this constant doesn’t exist in sass-rails. I just don’t understand how this could work.
Did you find any solution?

I gave up trying to configure it.

bndn commented Sep 30, 2012

I found a workaround. I added the compressor Sass::Rails::CssCompressor in application.rb to override the default one :

Sprockets::Compressors.register_css_compressor(:scss, 'Sass::Rails::CssCompressor', :require => 'sass/rails/compressor')

It works now.

Member

arthurnn commented Oct 19, 2012

is there a better fix for this? or thats the way to go?(the code in application.rb)

fenelon commented Jan 18, 2013

I've just started getting this error on precompile. I wonder why now and if there is a solution available?

  • rails (3.2.11)
  • sass (3.2.5)
  • sass-rails (3.2.6)

mptre commented Jan 19, 2013

Upgrading from 3.2.5 to 3.2.6 breaks the precompilation for me as well.

$ RAILS_ENV=production bundle exec rake assets:precompile
...
rake aborted!
uninitialized constant Sass::Rails::Compressor
...

rhizome commented Jan 19, 2013

Downrev to 3.2.5 worked for me

We had the same problem. I found rails/rails#1626 (2 year old =)

Removing config.assets.css_compressor from your config (this is handled internally by sass-rails) solves the issue.

fenelon commented Jan 22, 2013

Sprockets::Compressors.register_css_compressor... works for me, but I think there should be a more straightforward solution. 🔧

@fenelon yea that works but the thing is it's not necessary to set a sass compressor unless you want something else than the default. having config.assets.css_compressor = :scss is an old config many people have left in their files.

For a long time this has ”worked” since sass-rails has ignored the config but since #105 was merged it now tries to resolve it to a compressor, hence the error.

As far as I understand it now you can use the css_compressor config to use another compressor (like yui) but you should not have it if you just want the default (since :scss does not map to it)

fenelon commented Jan 22, 2013

@joeljunstrom Might be. But it fails to work without this hack.

So the problem I suppose is in actionpack's sprocket that looks for Sass::Rails::Compressor whereas sass-rails exposes Sass::Rails::CssCompressor so it won't work by default...

I wonder if we should just patch this in Gentoo in the mean time..

Contributor

frodsan commented Apr 30, 2013

Closing here. Sass::Rails::Compressor was removed by c861072.

@frodsan frodsan closed this Apr 30, 2013

ryanmuller added a commit to ryanmuller/learntrace that referenced this issue Jan 1, 2014

krbullock pushed a commit to rubymn/ruby.mn-website that referenced this issue Jan 27, 2014

remove config.assets.css_compressor setting
Breaks asset precompile on heroku. Fix found at:
<rails/sass-rails#111 (comment)>

The recommendation by @sphax3d was the only thing that worked for me. Thanks! 👍

Sprockets::Compressors.register_css_compressor(:scss, 'Sass::Rails::CssCompressor', :require => 'sass/rails/compressor')

thepeklis pushed a commit to thepeklis/praguerb that referenced this issue Oct 19, 2015

@Vasfed Vasfed referenced this issue in Vasfed/csso-rails Aug 4, 2017

Closed

Missing argument in initialize #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment