0

每当我运行rake assets:precompile时,我都会得到一个manifest.yml如下所示的文件:

--- {}

一定是出了什么问题。这是我的输出rake assets:precompile --trace

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/user/.rvm/gems/ruby-1.9.3-p194@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** 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 tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest

有人可以帮忙吗??谢谢!

更新:

随意查看我的代码www.github.com/sambaek/novulty

4

1 回答 1

0

当我rake assets:precompile为您的应用程序运行时,我得到以下输出

➜  novulty git:(master) ✗ rake assets:precompile                     
/Users/deefour/.rbenv/versions/1.9.3-p125/bin/ruby /Users/deefour/.rbenv/versions/1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Undefined variable: "$baseLineHeight".
  (in /Users/deefour/.rbenv/versions/1.9.3-p125/gemsets/novulty/gems/bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/deefour/.rbenv/versions/1.9.3-p125/...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
rake assets:precompile  12.50s user 1.21s system 99% cpu 13.744 total

我不确定你的意图是什么,但你有

  • app/asssets/bootstrap.min.css被包含在app/assets/application.css
  • gem 'bootstrap-sass'在你的Gemfilewhich 似乎导致bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss (在其他文件中)被添加到你的管道中,即使它们不包含在 require 行中app/assets/application.css

似乎您包含了引导 gem 以使用它的 Javascript 插件,但是试图省略 SASS 文件以支持硬编码的缩小 CSS 文件?

无论如何,我得到的错误表明$baseLineHeightSASS 变量没有为该 gem 文件资产中的一行定义 - 否则您似乎会忽略的资产(据我所知)

然后我做了以下

  1. 注释掉bootstrap-sass你的宝石Gemfile

    #gem 'bootstrap-sass'
    
  2. bundle

  3. rake assets:clean
  4. 从您删除了以下要求行,app/assets/application.js因为它们来自我在1.bootstrap-sass删除的 gem

    //= require bootstrap-transition
    //= require bootstrap-button
    //= require bootstrap-carousel
    //= require bootstrap-collapse
    //= require bootstrap-tab
    
  5. rake assets:precompile

这导致以下结果public/assets/manifest.yml

我认为您需要以下任何一项

  • 按预期使用bootstrap-sass宝石。在您的中包含 SASS 文件app/assets/application.css (这样做有点超出了这个问题的范围)
  • bootstrap-sass像我上面那样摆脱gem,并将必要的 Javascript 文件作为资产包含在您的vendor/assets/javascripts目录中(这也是app/assets/stylesheets/bootstrap.min.css属于的地方 - vendor/assets/stylesheets
于 2012-11-08T03:14:11.900 回答