I'm using grunt and also grunt plugins like grunt-contrib-copy
, grunt-contrib-mincss
(that listed as npm dependencies for my application).
Also I don't commit npm_modules
folder and public
folder, where all generated files are. And I can't figure out how to build my app (I have grunt build
command) after deploy and setup my server (it's already looking for public
folder).
I saw some stuff like grunt-heroku-deploy
, but it seems me a bad idea to commit before upload. Maybe there are some gentle decisions... Any thoughts?
The npm postinstall step is probably your best option, since you can invoke grunt from there. But you should also check out a custom buildpack, such as heroku-buildpack-nodejs-grunt.
This looks like it will largely be solved when the Heroku Platorm API
slug
andrelease
features make it into the mainline. At that point, you can build your code locally (or on a ci server), package it up and send it to heroku via an API call and release it from there.This is still in the beta period and was only announced on December 19, 2013.
https://devcenter.heroku.com/articles/platform-api-deploying-slugs
I was never super happy with how many people seemed ok with checking in your generated code into git or the NPM postinstall hook. :(
Plus from a philosophical stance, doing a build during a release is simply another potential failure point.
Just for fun: Since that's not finalized yet, here's a bash script I threw together you can use for the time being to build your code on a deployment branch, commit it, deploy it to heroku and then remove the deployment branch. (I really am not a fan of bash deployment scripts, so I'm really looking forward to the platform API additions)