Jo Liss: modern build workflows with Broccoli

Orde Saunders' avatarPublished: by Orde Saunders

Jo Liss (@jo_liss) was talking about Broccoli at Scotland.js, these are my notes from her talk.

With big projects a grunt watch task can take a long time which slows down feedback and breaks you out of flow.

Broccoli starts with a Brocfile.js.  Tasks represent trees that get merged for the module.exports.  Trees  can have other trees passed in to them.  There is no code to maintain intermediate directories - Broccoli manages this for you.  Broccoli doesn't think about files, only trees.

Should you use Broccoli - it's still beta.  The architecture is solid but the API needs changes.  Use it if you can cope with breakage, should be stable in a few months.

Plugin API

If your build tool has a large API surface it's hard to change later.  Broccoli tries to keep the API basic - offloads complexity to helper libraries.  You'll normally be writing against the helper APIs.

The Broccoli filter has a cache which is what enables the fast rebuild.  It means we don't have to re-process all the inputs each time.  As filters work on 1:1 relationships this is possible.


Broccoli is more or a library than a tool.  Probably going to work well as a Grunt plugin.  Grunt is a task runner, not a build tool.  grunt-broccoli is probably going to be the way to go.

Would be good to have generated stacks with default build definitions, pre-generated to get you started.

Comments, suggestions, corrections? Contact me via this website