UNPKG

before-brunch

Version:

Plugin that runs commands before Brunch compiling.

47 lines (38 loc) 1.09 kB
// Generated by CoffeeScript 1.9.1 (function() { var AfterBrunch, exec, sysPath; sysPath = require('path'); exec = require('child_process').exec; module.exports = AfterBrunch = (function() { AfterBrunch.prototype.brunchPlugin = true; function AfterBrunch(config) { var ref; this.config = config; this.commands = (ref = this.config.plugins.beforeBrunch) != null ? ref : []; } AfterBrunch.prototype.preCompile = function(end) { var command, i, len, ref; if (this.commands.length > 0) { ref = this.commands; for (i = 0, len = ref.length; i < len; i++) { command = ref[i]; exec(command, function(error, stdout, stderr) { if (stdout) { console.log(stdout); } if (error) { console.log(error.message); } if (stderr) { console.log(stderr); } return end(); }); } } else { end(); } }; return AfterBrunch; })(); }).call(this);