Skip to content

Instantly share code, notes, and snippets.

@NickHeiner
Last active August 29, 2015 14:15
Show Gist options
  • Save NickHeiner/ecae091746f8c700423f to your computer and use it in GitHub Desktop.
Save NickHeiner/ecae091746f8c700423f to your computer and use it in GitHub Desktop.
Handling logging
// index.js
function myTask(rawArgs) {
var args = fillInDefaults(rawArgs, {
log: console.log
});
}
// tasks/task.js
module.exports = function(grunt) {
grunt.registerMultiTask('my-task', function() {
var myTask = require('../');
// The argument passed to options() serves as defaults.
var options = this.options({
log: console.log
});
myTask(options);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment