生产中的Rails资产 [英] Rails Assets in Production

查看:67
本文介绍了生产中的Rails资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚迁移到Rails 3.1,但是在资产管道入门方面遇到了麻烦.

I've just migrated to rails 3.1 and I'm having trouble getting started with the asset pipeline.

我运行:bundle exec rake assets:precompile RAILS_ENV=production将其他css文件添加到config.assets.precompile += ['scaffold.css', 'other.css', 'other.js']后,我所有的文件都位于/app/asset图像,javascript或样式表路径中.

I ran: bundle exec rake assets:precompile RAILS_ENV=production after adding additional css files into config.assets.precompile += ['scaffold.css', 'other.css', 'other.js'] all of my files are located in the /app/asset images, javascripts, or stylesheets path.

在执行rake任务之后,我可以看到manifest.yml文件,但是它缺少我添加到config.assets.precompile

Following the rake task, I can see the manifest.yml file but it is missing the additional css and js files I added to the config.assets.precompile

这是我放在清单上的manifest.yml文件:

Here is my manifest.yml file that lives on prod:

connect.gif:connect-b85d46914c10cb653f3444c3529b83eb.gif connect.png: connect-bce549a396f27cc5f7b315190ee3385a.png d.jpeg: d-c5f2ca3025794efdc341159538f4a0bf.jpeg data.png: data-d225a9937a1aa78805e704ada167b2d0.png fb.png: fb-2e743f3607323f9d21dd2e96b5c95d4b.png feed.png: feed-fd4c0dc513639edd0ba2f39a063fdc90.png grid.png: grid-b3db76abb46477b06c15055df8412c79.png i.png: i-5ac52498083d9dfc5f898cdf666bc9c0.png infb.png: infb-80208a4e1bd3d2a03f23097a7d19fe7e.png r.png: r-ba27ded8b8873c851cd9aaf8697f8092.png rails.png: rails-e4b51606cd77fda2615e7439907bfc92.png share.jpeg: share-47877a532c58510f38eeb534122b4846.jpeg share.png: share-b9939bdcdf8b082eeb27697592258b9a.png signup.jpeg: signup-23dfea4e8af95dae93ab254162e01fc2.jpeg tc.png: tc-abb1838a7396c3a0a54e68ecb80cd225.png tweet.png: tweet-3865676af138fa7d80e0e416210f2fa0.png yellow.png: yellow-b2257e0f9bb17cd4b44faaee30df8fa6.png jquery.flot.js: jquery.flot-944582c3d888856c9d82964ea8cf0bcc.js jquery-ui.min.js: jquery-ui.min-4258e47b40673a02bedfda178628bfba.js jquery.min.js: jquery.min-17322428695737103f15e8b9db8b5909.js application.js: application-f71535809bb0483163e3e4d857abe6d0.js

connect.gif: connect-b85d46914c10cb653f3444c3529b83eb.gif connect.png: connect-bce549a396f27cc5f7b315190ee3385a.png d.jpeg: d-c5f2ca3025794efdc341159538f4a0bf.jpeg data.png: data-d225a9937a1aa78805e704ada167b2d0.png fb.png: fb-2e743f3607323f9d21dd2e96b5c95d4b.png feed.png: feed-fd4c0dc513639edd0ba2f39a063fdc90.png grid.png: grid-b3db76abb46477b06c15055df8412c79.png i.png: i-5ac52498083d9dfc5f898cdf666bc9c0.png infb.png: infb-80208a4e1bd3d2a03f23097a7d19fe7e.png r.png: r-ba27ded8b8873c851cd9aaf8697f8092.png rails.png: rails-e4b51606cd77fda2615e7439907bfc92.png share.jpeg: share-47877a532c58510f38eeb534122b4846.jpeg share.png: share-b9939bdcdf8b082eeb27697592258b9a.png signup.jpeg: signup-23dfea4e8af95dae93ab254162e01fc2.jpeg tc.png: tc-abb1838a7396c3a0a54e68ecb80cd225.png tweet.png: tweet-3865676af138fa7d80e0e416210f2fa0.png yellow.png: yellow-b2257e0f9bb17cd4b44faaee30df8fa6.png jquery.flot.js: jquery.flot-944582c3d888856c9d82964ea8cf0bcc.js jquery-ui.min.js: jquery-ui.min-4258e47b40673a02bedfda178628bfba.js jquery.min.js: jquery.min-17322428695737103f15e8b9db8b5909.js application.js: application-f71535809bb0483163e3e4d857abe6d0.js

这是怎么回事?我已经用touch restart.txt和nginx重新启动了这两个乘客.我已经阅读了有关此问题的所有文档.

What is going on here? I've restarted both passenger with touch restart.txt and nginx. I've read all of the documentation on this issue.

nginx error.log:

cache: [GET /] miss

ActionView::Template::Error (scaffold.css isn't precompiled):
    2: %html
    3:   %head
    4:     %title redmeetsblue
    5:     
    6:     = javascript_include_tag "application.js"
    7:     = csrf_meta_tag
    8:     %script{:src => "http://connect.facebook.net/en_US/all.js#appId=143150285757259&xfbml=1"}
  app/views/layouts/application.html.haml:5:in `_app_views_layouts_application_html_haml__44133251_81438200'
  app/controllers/homes_controller.rb:7:in `index'

推荐答案

是否已在application.rb中设置config.assets.precompile值?如果将它们设置在其他位置,则在您进行预编译时不会选择它们.

Have you set the config.assets.precompile values in application.rb ? If you set them elsewhere they won't be picked up when you precompile.

这篇关于生产中的Rails资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆