是否有可能跳过Heroku上单个git推送的资产预编译步骤?
每次我将我的Rails 3.2项目部署到Heroku时, rake assets:precompile
运行rake assets:precompile
:
$ git push heroku master ... ----> Preparing app for Rails asset pipeline Running: rake assets:precompile Asset precompilation completed (189.17s) ...
有时我想推动我知道不会改变任何资产,例如对控制器的快速修补程序。 是否有可能跳过资产:单个git推送到Heroku的预编译步骤?
谢谢。
当然! 您需要在your_app/pubilc/assets
目录中创建manifest.yml
。
该文件可以为空。 但理想情况下,您在本地预编译所有内容,因此部署到Heroku会快得多。
当你推送到Heroku时,确保你也提交了manifest.yml
文件。 像git add -f your_app/pubilc/assets/manifest.yml
和git push heroku master
应该足够了。
这对我有用。 manifest.yml在我的rails 4项目上没有为我做任何事。
在rails 4中,创建文件manifest-
而不是manifest.yml
只需在本地使用rake assets: precompile
,检入public/assets
,然后推送到heroku。
这将自动在您的public/assets
目录中创建manifest-.yml或json文件; 然后heroku将检测到并报告Detected manifest file, assuming assets were compiled locally
。
注1:有些人在development.rb
中有一行,这些行使这些行转到public/dev-assets instead
; 如果是这样,您需要将dev-assets
重命名为just assets
注意2:确保您的.gitignore
文件不排除public/assets
目录。