UNPKG

broccoli-brocfile-loader

Version:

Find and load Brocfile.js files for use with the Broccoli asset builder

22 lines (15 loc) 483 B
var path = require('path') var findup = require('findup-sync') module.exports = loadBrocfile function loadBrocfile () { var brocfile = findup('Brocfile.js', { nocase: true }) if (brocfile == null) throw new Error('Brocfile.js not found') var baseDir = path.dirname(brocfile) // The chdir should perhaps live somewhere else and not be a side effect of // this function, or go away entirely process.chdir(baseDir) var node = require(brocfile) return node }