Created
September 17, 2012 17:54
-
-
Save cowboy/3738764 to your computer and use it in GitHub Desktop.
gruntfile idea
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
var grunt = require('grunt'); | |
// Init config | |
exports.config = { | |
awesome: { | |
target1: {src: ['foo.js', 'bar.js']} | |
} | |
}; | |
// Initialize task object | |
exports.tasks = {}; | |
// Full task | |
exports.tasks.awesome = { | |
description: 'The most awesome task ever.', | |
type: 'multi', | |
main: function(arg) { | |
var files = grunt.file.expandFiles(grunt.util._.pluck(this.files, 'src')); | |
var success = this.task.listFiles(files); | |
grunt.log.writeln('Stuff happened...'); | |
if (success) { grunt.log.ok(); } else { grunt.log.error(); } | |
}, | |
listFiles: function(files) { | |
files.forEach(function(filepath) { | |
grunt.log.writeln(filepath); | |
}); | |
return files.length > 0; | |
}, | |
}; | |
// Alias task | |
exports.tasks.default = ['awesome']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment