生产中的 Rails 资产

发布于 2025-01-05 01:34:06 字数 2169 浏览 4 评论 0原文

我刚刚迁移到 Rails 3.1,但在开始使用资产管道时遇到了困难。

在将额外的 css 文件添加到 config.assets.precompile += ['scaffold.css', 'other.css', 'other .js'] 我的所有文件都位于 /app/asset 图像、javascript 或样式表路径中。

在rake任务之后,我可以看到manifest.yml文件,但它缺少我添加到config.assets.precompile中的附加css和js文件

这是我位于产品上的manifest.yml文件:

connect.gif:connect-b85d46914c10cb653f3444c3529b83eb.gif connect.png: 连接-bce549a396f27cc5f7b315190ee3385a.png d.jpeg: d-c5f2ca3025794efdc341159538f4a0bf.jpeg data.png: 数据-d225a9937a1aa78805e704ada167b2d0.png fb.png: fb-2e743f3607323f9d21dd2e96b5c95d4b.png feed.png: feed-fd4c0dc513639edd0ba2f39a063fdc90.png grid.png: 网格-b3db76abb46477b06c15055df8412c79.png i.png: i-5ac52498083d9dfc5f898cdf666bc9c0.png infb.png: infb-80208a4e1bd3d2a03f23097a7d19fe7e.png r.png: r-ba27ded8b8873c851cd9aaf8697f8092.pngrails.png: Rails-e4b51606cd77fda2615e7439907bfc92.png share.jpeg: share-47877a532c58510f38eeb534122b4846.jpeg share.png: 分享-b9939bdcdf8b082eeb27697592258b9a.png signup.jpeg: 注册-23dfea4e8af95dae93ab254162e01fc2.jpeg tc.png: tc-abb1838a7396c3a0a54e68ecb80cd225.png tweet.png: tweet-3865676af138fa7d80e0e416210f2fa0.png Yellow.png: 黄色-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: 应用程序-f71535809bb0483163e3e4d857abe6d0.js

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

nginx错误日志:

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'

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

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.

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

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

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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梅倚清风 2025-01-12 01:34:06

您是否在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文