【问题标题】:Manifest.yml emptyManifest.yml 为空
【发布时间】:2012-11-03 22:00:49
【问题描述】:

每当我运行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

【问题讨论】:

  • 拥有关于您的app/assetslib/assetsvendor/assets 内容的任何 信息以及应用程序的YOURAPPLICAION::Application.config.assets.precompile 值的值将会很有用。
  • 抱歉回复晚了。我添加了我的 github 存储库。希望有帮助!

标签: ruby-on-rails ruby-on-rails-3 heroku asset-pipeline


【解决方案1】:

当我为您的应用程序运行 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' 在您的 Gemfile 中,这似乎会导致 bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss (以及其他文件) 被添加到您的管道中,即使它们未包含在 app/assets/application.css 的要求行中

您似乎包含了 bootstrap gem 以使用它的 Javascript 插件,但正在尝试省略 SASS 文件以支持硬编码、缩小的 CSS 文件?

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

然后我做了以下

  1. 在您的Gemfile 中注释掉bootstrap-sass gem

    #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 gem。在您的app/assets/application.css 中包含 SASS 文件(这样做有点超出了这个问题的范围)
  • 摆脱上面的bootstrap-sass gem,并将必要的Javascript文件作为资产包含在您的vendor/assets/javascripts目录中(这也是app/assets/stylesheets/bootstrap.min.css所属的位置-vendor/assets/stylesheets

【讨论】:

  • 感谢您的帮助。抱歉这么晚才回复。但你是对的!
猜你喜欢
  • 2012-04-12
  • 2017-07-21
  • 1970-01-01
  • 2016-06-09
  • 2013-01-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多