Rails 3.1.1 asset pipeline Heroku caching gotcha

后端 未结 3 1116
攒了一身酷
攒了一身酷 2021-02-01 10:13

The problem in a nutshell is that in development mode we\'d make changes to CSS or JS files but would always get cached/old versions of these files. Nothing I did had any effect

相关标签:
3条回答
  • 2021-02-01 10:36

    The reason the asset precompilation does not work could well be, that the Heroku ENV vars are not present on slug compilation (deploy) as stated here:

    http://devcenter.heroku.com/articles/rails31_heroku_cedar

    There is an (experimental) way to enable the ENV vars during deploy for exactly this reason, find information here:

    http://devcenter.heroku.com/articles/labs-user-env-compile

    Hope this helps.

    0 讨论(0)
  • 2021-02-01 10:47

    Check this guide from Heroku. It outlines the 3 ways to deploy Rails 3.1 apps. Two of these do not required local precompilation.

    0 讨论(0)
  • 2021-02-01 10:50

    Have you checked out this devise issue on github? Specifically Jose Valim says

    Rails 3.1.1 final has a method called config.assets.initialize_on_precompile. If you set it to false, you should be good but it won't allow you to access model information on your assets (which you probably shouldn't anyway).

    Maybe this will allow the precompile to happen on Heroku for you.

    0 讨论(0)
提交回复
热议问题