grunt
grunt copied to clipboard
Get queued task list
The possibility to easily retrieve the list of task names in the queue.
Something like this:
grunt.registerTask('default', ['jscs:all', 'jshint']);
// When running `grunt`
grunt.task.queue; // ['jscs:all', 'jshint']
// When running `grunt default`
grunt.task.queue; // ['jscs:all', 'jshint']
// When running `grunt jshint`
grunt.task.queue; // ['jshint']
// When running `grunt jshint:all`
grunt.task.queue; // ['jshint:all']
The reason behind this request is because of hacks we're doing with grunt that we're not proud of :D
And interesting aspect of this feature is that the queue property should be "live". For example:
// When running `grunt`
grunt.task.queue; // ['default']
grunt.registerTask('default', ['jscs', 'jshint']);
// `default` is replaced in `queue` automatically
grunt.task.queue; // ['jscs', 'jshint']
More fancy:
// When running `grunt`
grunt.task.queue; // ['default']
grunt.registerTask('lint', ['jscs', 'jshint']);
grunt.registerTask('default', ['lint', 'build']);
// all aliases get replace to their "final/real" tasks
grunt.task.queue; // ['jscs', 'jshint','build']
// When running `grunt lint`
grunt.task.queue; // ['lint']
grunt.registerTask('lint', ['jscs', 'jshint']);
grunt.task.queue; // ['jscs', 'jshint']
grunt.task.run('build');
grunt.task.queue; // ['jscs', 'jshint', 'build']
+1 Interesting!
Any updated on this? Very interesting..
+1
Any update on this?