I currently am creating a custom Grunt task for my application. It does several things, and in order to achieve these, I use a few existing Grunt tasks.
Below is how I have chosen to create my task, by aggregating these others.What I would like to know, is this a common way of extending a task or is there a better way?
Functionally it works, but I some how feel this is a hack?
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-mkdir');
var _ = require('lodash');
var options = this.options();
grunt.registerTask('custom-task-name', 'Custom task description', function () {
// Config ommited for brevity.
grunt.initConfig({
clean: {
},
mkdir: {
},
copy: {
},
shell: {
},
});
var tasks = ['clean', 'mkdir:target', 'copy:target', 'shell:target'];
grunt.task.run(tasks);
});
};
Aucun commentaire:
Enregistrer un commentaire