Last active
August 29, 2015 14:15
-
-
Save NickHeiner/ecae091746f8c700423f to your computer and use it in GitHub Desktop.
Handling logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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