在推送到Heroku之前自动预先编译资源 [英] Automatically precompile assets before pushing to Heroku

查看:96
本文介绍了在推送到Heroku之前自动预先编译资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在推送到Heroku之前自动预编译我的资产到Rails应用程序中?我总是忘记这么做,所以如果我输入 git push heroku master ,它会很好,它会首先运行 rake assets:precompile; git commit add。 ; git commit -a -m预编译。,或者其他的东西。

Is it possible to automatically precompile my assets in a Rails app before pushing out to Heroku? I always forget to do it, so it would be nice if when I typed git push heroku master, it would first run rake assets:precompile ; git commit add . ; git commit -a -m "Precompile.", or something to that effect.

有没有人取得这样的解决方案?可能没有挂钩?虽然我怀疑这是唯一的方法。

Has anyone achieved such a solution? Possibly without hooks? Though I suspect that is the only way.

推荐答案

我终于明白了这一点。我确实在Cedar堆栈上。问题在于我检查了我的 public 目录到Git中,当我推送到Heroku时,它意识到 public 存在,并因此假定我进行了预编译。运行 git rm -r public 并将 public / ** 添加到我的 .gitignore code>,然后推送,修复问题。

I finally figured this out. I was indeed on the Cedar stack. The problem was that I had checked my public directory into Git, and when I pushed to Heroku, it realized that public existed, and thus assumed I precompiled. Running git rm -r public and adding public/** to my .gitignore, then pushing, fixes the problem.

这篇关于在推送到Heroku之前自动预先编译资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆