How to deploy node app that uses grunt to heroku

前端 未结 7 2167
悲哀的现实
悲哀的现实 2020-11-29 17:20

I\'m using grunt and also grunt plugins like grunt-contrib-copy, grunt-contrib-mincss (that listed as npm dependencies for my application).

7条回答
  •  孤街浪徒
    2020-11-29 17:47

    Grunt (et al.) is a build tool, not (really) something you should be packaging up and running on production. A different approach would be to use Grunt to prepare your project locally (or better on a CI server) before only pushing the built files to Heroku. As already mentioned Heroku will do an npm install on your app after its pushed which should be enough on its own to finally prepare your app.

    I have it set up so that the Grunt derived/built Heroku app lives in a totally separate Git repo to my main app source code repo. So that when I do a grunt deploy it optimises and copies the relevant files to the Heroku repo, tidies it up (git add -A etc.) and then git push heroku master (or whatever).

    It seems like a cleaner separation of concerns if your live servers are only responsible for running a pre-built app package.

    YMMV of course, and the accepted answer above is totally valid too ... especially on a well understood and stable live environment like Heroku.

提交回复
热议问题