Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy node that uses Gulp to heroku

I'm using gulp and also gulp plugins like gulp-minify-css, gulp-uglify etc (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 gulp build command) after deploy and setup my server (it's already looking for public folder).

It seems me a bad idea to commit before upload. Maybe there are some gentle decisions... Any thoughts?

Forked from: How to deploy node app that uses grunt to heroku

like image 499
Inanc Gumus Avatar asked Jul 01 '14 07:07

Inanc Gumus


1 Answers

I was able to get this to work by adding this into my "package.json" file:

"scripts": {   "start": "node app",   "postinstall": "gulp default" } 

The postinstall script is run after the build pack. Check this for more information. The only annoying thing is that all of your dependencies have to live under "dependencies" instead of having separate "devDependencies"

I didn't need to do anything else with buildpacks or configuration. This seems like the simplest way to do it.

I wrote about the process I used here

like image 78
arb Avatar answered Sep 22 '22 06:09

arb