Want to run a javascript function every time brunch compiles? Easy.
Add "before-brunch-func": "x.y.z" to package.json of your brunch app.
Or npm install before-brunch-func --save.
Then in your config.coffee just add to the func parameter, a function that
accepts an errback as its only argument . E.g.
beforeFunc = (errback) ->
console.log 'hello world'
errback falseFor example, you might want to build metalsmith before each compile.
metalsmith = require './metalsmith'
exports.config =
…
plugins:
before:
func: metalsmith.build.bind(metalsmith)
pattern: /^src/ # default
warnOnly: false # default
firstCompileOnly: false # default