Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created September 17, 2012 17:54
Show Gist options
  • Save cowboy/3738764 to your computer and use it in GitHub Desktop.
Save cowboy/3738764 to your computer and use it in GitHub Desktop.
gruntfile idea
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