Rails 4: assets not loading in production

前端 未结 18 1383
梦如初夏
梦如初夏 2020-11-29 15:15

I\'m trying to put my app into production and image and css asset paths aren\'t working.

Here\'s what I\'m currently doing:

  • Image assets live in /app/a
18条回答
  •  一整个雨季
    2020-11-29 15:54

    The default matcher for compiling files includes application.js, application.css and all non-JS/CSS files (this will include all image assets automatically) from app/assets folders including your gems:

    If you have other manifests or individual stylesheets and JavaScript files to include, you can add them to the precompile array in config/initializers/assets.rb:

    Rails.application.config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']
    

    http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

提交回复
热议问题