0

我正在使用 activeadmin gem,当您执行 bundle install 时,它应该负责安装 sass。当我进行捆绑表演时,我可以看到 sass(3.2.5) 存在。但是,当我从我的 :assets 组中删除 sass 时,我的 rake 命令未能给出异常:

rake aborted!
cannot load such file -- sass-rails
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/active_admin/sass/helpers.rb:3:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/active_admin.rb:11:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/activeadmin.rb:1:in `require'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/activeadmin-0.5.1/lib/activeadmin.rb:1:in `<top (required)>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `each'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `block in require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `each'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `require'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/gems/bundler-1.2.4/lib/bundler.rb:128:in `require'
/Users/kc025858/webApp/data-source-onboarding/config/application.rb:10:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/Rakefile:4:in `require'
/Users/kc025858/webApp/data-source-onboarding/Rakefile:4:in `<top (required)>'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:604:in `raw_load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:89:in `block in load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:88:in `load_rakefile'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:72:in `block in run'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:70:in `run'
/Users/kc025858/webApp/data-source-onboarding/vendor/cache/ruby/1.9.1/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385@global/bin/rake:19:in `load'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385@global/bin/rake:19:in `<main>'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/Users/kc025858/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>

当您已经包含 ActiveAdmin 时,为什么还需要将 sass 包含到您的 gemfile 中?

如果您看到dependency.txt,您会发现sass 是activeadmin 的一部分。

activeadmin (0.5.1)
      arbre (>= 1.0.1)
      bourbon (>= 1.0.0)
      devise (>= 1.1.2)
      fastercsv
      formtastic (>= 2.0.0)
      inherited_resources (>= 1.3.1)
      jquery-rails (>= 1.0.0)
      kaminari (>= 0.13.0)
      meta_search (>= 0.9.2)
      rails (>= 3.0.0)
      sass (>= 3.1.0)
4

2 回答 2

0

不知道为什么,但 ActiveAdmin 的网站在其文档中明确指出,您需要在 gemfile 中包含 sass-rails:

If you are using Rails >= 3.1, you must also include a beta version of MetaSearch and sass-rails

于 2013-02-20T21:59:35.683 回答
0

ActiveAdmin 在其依赖列表中有 sass 但没有 sass-rails,这是在 rails 资产管道中添加 sass 适配器所必需的。

于 2013-02-23T13:51:08.830 回答