1

我正在将 3.0 Rails 应用程序升级到 3.1.4,包括资产管道。

我在 Heroku,所以我的 application.rb 中有这个

config.assets.initialize_on_precompile = false

我注意到当我运行时:

bundle exec rake assets:precompile

它在 public/assets 目录中创建文件(即使我的资产已经在 app/assets 中)。

例如,它会创建像 application-72b2779565ba79101724d7356ce7d2ee 这样的文件,以及复制我在 app/assets 中的图像。

我的问题是:(1)应该将这些文件上传到我的生产服务器吗?(2) 如果我想上传这些,我想更新每个应用程序-xxxxxxxx 还是只更新最新的?

4

1 回答 1

0

To your first question: Heroku will not allow you to modify the filesystem. So your assertion is correct- You will need to pre-compile the asset pipeline before you send it up to Heroku, so that it can be utilized in your production environment.

And the latter: You'll want to make sure you have the latest compilation. Any others wont be used. The "xxxxxxx" portion is to make sure that your users have the latest and greatest version of your assets. It's a way of versioning what the browser gets, and making sure they're not caching a bad copy of the JavaScript, when you want to set up their cache to hold on to the JS and CSS files as long as they can, instead of constantly getting it from your web server.

Take my Heroku comments with a slight grain of salt, as I have not deployed to Heroku before. I just know how their system works to some degree.

于 2012-05-01T03:41:37.437 回答