Created
September 17, 2012 15:37
-
-
Save cowboy/3738047 to your computer and use it in GitHub Desktop.
task definitions
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
// inside a gruntfile | |
grunt.registerTask('awesome', { | |
description: 'The most awesome task ever.', | |
type: 'multi', | |
main: function(grunt, arg) { | |
var files = grunt.file.expandFiles(grunt.util._.pluck(this.files, 'src')); | |
var success = this.task.listFiles(grunt, files); | |
grunt.log.writeln('Stuff happened...'); | |
if (success) { grunt.log.ok(); } else { grunt.log.error(); } | |
}, | |
listFiles: function(grunt, files) { | |
files.forEach(function(filepath) { | |
grunt.log.writeln(filepath); | |
}); | |
return files.length > 0; | |
}, | |
}); | |
// inside a plugin, initialized with something like... | |
exports.awesome = { | |
description: 'The most awesome task ever.', | |
type: 'multi', | |
main: function(grunt, arg) { | |
var files = grunt.file.expandFiles(grunt.util._.pluck(this.files, 'src')); | |
var success = this.task.listFiles(grunt, files); | |
grunt.log.writeln('Stuff happened...'); | |
if (success) { grunt.log.ok(); } else { grunt.log.error(); } | |
}, | |
listFiles: function(grunt, files) { | |
files.forEach(function(filepath) { | |
grunt.log.writeln(filepath); | |
}); | |
return files.length > 0; | |
}, | |
}; |
tkellen
commented
Sep 17, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment