Rails Assets in Production

2019-09-18 10:36发布

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'

1条回答
劫难
2楼-- · 2019-09-18 11:10

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.

查看更多
登录 后发表回答