Skip to content

Instantly share code, notes, and snippets.

@paulmillr
Last active March 29, 2019 23:12
Show Gist options
  • Star 34 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulmillr/3596447 to your computer and use it in GitHub Desktop.
Save paulmillr/3596447 to your computer and use it in GitHub Desktop.
Build & deploy brunch applications on Heroku.
  1. Add to .gitignore:

    node_modules
    public
    
  2. Add to your app dependencies of package.json:

    "statik": ">= 1.1.0", 
    "brunch": "1.x",
    
  3. Create server.js:

    var statik = require('statik');
    statik(process.env.PORT || 1337);
  4. Add Procfile.

    web: node server.js
    
  5. Add to scripts section of package.json:

    "postinstall": "brunch build --optimize"
    
  6. Deploy, PROFIT!

@chrisnicola
Copy link

I had a couple of issues with this recently using the AngularJS seed (not sure about others). First is Heroku's expectations for Node and NPM require this:

  "engines": {
    "node": "~0.8.14",
    "npm": "~1.1"
  },

Second the public folder was named _public for some reason now so you'll need to start static.createServer('_public') now obviously. Hope that's helpful.

@jkresner
Copy link

Here's how I go about it:

https://gist.github.com/jkresner/5377677

@yagudaev
Copy link

yagudaev commented Jul 6, 2015

I couldn't get this to work on heroku, ended up using Koa and for things and needed a multipack for having ruby there to install sass gem (since I was using it in my project)

@aleavikraman
Copy link

"postinstall": "brunch build --optimize"
has changed to
"postinstall": "brunch build --production",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment