Rails 4: assets not loading in production

前端 未结 18 1434
梦如初夏
梦如初夏 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:58

    In /config/environments/production.rb I had to add this:

    Rails.application.config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb )
    

    The .js was getting precompiled already, but I added it anyway. The .css and .css.erb apparently don't happen automatically. The ^[^_] excludes partials from being compiled -- it's a regexp.

    It's a little frustrating that the docs clearly state that asset pipeline IS enabled by default but doesn't clarify the fact that only applies to javascripts.

提交回复
热议问题