Create a gist now

Instantly share code, notes, and snippets.

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

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

Here's how I go about it:

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

@yagudaev
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)

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