How to deploy node app that uses grunt to heroku

前端 未结 7 2155
悲哀的现实
悲哀的现实 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:57

    To get this working with grunt 4.0 I followed the instructions here https://discussion.heroku.com/t/grunt-on-heroku/98/2 . The only change I had to make was to remove the path to grunt as using unix style slashes would make it fail in windows and vice versa. Luckily you don't even need to specify the path as NPM will look for grunt in the node_modules/.bin folder https://npmjs.org/doc/scripts.html#path.

    1. make sure you have both grunt and grunt-cli installed locally in your package.json even if grunt tells you to install the cli globally: $: npm i -S grunt grunt-cli

    2. add a postinstall step to your package.json that looks like this: "postinstall": "grunt prod"

提交回复
热议问题