我想在 Heroku 上部署一个 angular+rails 应用程序。该应用程序基于 Emmanual Oda's example code 构建,并使用 Grunt 编译其 Assets 。
与其在本地编译我的 Assets 然后将它们提交到 git,我更愿意在 Heroku 上编译它们。也就是说,我想在部署我的应用程序时自动在 Heroku 上运行 grunt build
。
有谁知道如何配置 Heroku 来执行此操作?
编辑
我知道 Node.js 应用程序可以进行服务器端 Assets 编译,例如使用 mbuchetics' fork of the heroku nodejs buildpack .但是,当我按照该站点上的说明推送到 Heroku 时,出现以下错误
-----> Fetching custom git buildpack... done
! Push rejected, no Cedar-supported app detected
编辑 2
目前,我正在使用在本地运行 grunt build
的 Rake 任务进行部署。
task :deploy do
system("rm -rf ./public/*") # empty the public directory
system("cd ngapp; grunt build")
# make a bogus manifest file to turn off asset compilation on heroku
# see here: https://devcenter.heroku.com/articles/rails-asset-pipeline
system("mkdir public/assets; touch public/assets/manifest-098f6bcd4621d373cade4e832627b4f6.json")
system("git add public/")
system("git commit -m \"deploying...\"")
system("git push heroku master")
end
最好是服务器端解决方案!
最佳答案
我相信这就是您想要的:http://www.angularonrails.com/deploy-angular-rails-single-page-application-heroku/
此解决方案使用多个构建包在生产环境中运行 grunt build
。版本控制中没有构建工件。
关于ruby-on-rails - 如何在 Heroku 部署期间运行 "grunt build"(angular 和 ruby-on-rails 应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20929033/