Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Build & deploy brunch applications on Heroku.
  1. Add to .gitignore:

  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!

Copy link

chrisnicola commented Dec 6, 2012

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.

Copy link

jkresner commented Apr 13, 2013

Here's how I go about it:

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)

Copy link

aleavikraman commented Jul 13, 2017

"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