Is it possible to skip the asset precompile step for a single git push on Heroku?

被刻印的时光 ゝ 提交于 2019-12-03 19:05:22

问题


Every time I deploy my Rails 3.2 project to Heroku, rake assets:precompile is run:

$ git push heroku master  
...
----> Preparing app for Rails asset pipeline
      Running: rake assets:precompile
      Asset precompilation completed (189.17s)
...

Sometimes I want to make a push that I know does not change any assets, such as a quick hotfix to a controller. Is it possible to skip the asset:precompile step for a single git push to Heroku?

Thanks.


回答1:


Sure! You'll need to create a manifest.yml in your_app/pubilc/assets directory.

The file can be blank. But ideally, you precompile everything locally, so deploys to Heroku would be much faster.

Make sure that you also committed the manifest.yml file when you're pushing to Heroku. Something like git add -f your_app/pubilc/assets/manifest.yml and a git push heroku master should suffice.




回答2:


This worked for me. manifest.yml did nothing for me on my rails 4 project.

https://gist.github.com/Geesu/d0b58488cfae51f361c6




回答3:


In rails 4, create the file manifest-<md5 hash>.json instead of manifest.yml




回答4:


Just precompile locally with rake assets: precompile, check in the resulting assets that are in public/assets, and push to heroku.

This will automatically create the manifest-.yml or json file in your public/assets directory; then heroku will detect that and report Detected manifest file, assuming assets were compiled locally.

Note 1: Some people have a line in development.rb that makes these go to public/dev-assets instead; if so, you need to rename dev-assets to just assets)

Note 2: Make sure your .gitignore file is not excluding the public/assets directory.



来源:https://stackoverflow.com/questions/11596912/is-it-possible-to-skip-the-asset-precompile-step-for-a-single-git-push-on-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!