2

当我这样做时heroku rake assets:precompile,每次我这样做都需要将近 15 分钟,而且时间太长了。

我正在将asset_sync与heroku与S3一起使用,但有没有办法加快这个过程?

4

1 回答 1

0

您可以在本地预编译资产,这通常会更快。如果你这样做,请确保你有一个pre-commit compile git hook,这样你就不会忘记在部署时预编译(确保使用RAILS_ENV=production!)

https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally

如果在您的应用程序中检测到 public/assets/manifest.yml,Heroku 将假定您正在自己处理资产编译,并且不会尝试编译您的资产。Rails 4 使用了一个名为 public/assets/manifest-.json 的文件。最近的版本使用 public/assets/.sprockets-manifest-.json (注意点 . 表示它可能在您的机器上默认隐藏)。在所有版本上,您都可以通过在本地运行 $ rake assets:precompile 并将生成的文件检入 Git 来生成此文件。

于 2017-06-17T17:50:04.797 回答