extend grunt api, like grunt.file.copyDir...
extend grunt api, like grunt.file、grunt.task, and more.
In order to extend grunt API, first you need to install this plugin
npm install extend-grunt-api --save-dev
then, in your Gruntfile.js, add a line of code. All done, enjoy yourself. Currently, there are only a few APIs supplied, if you have more need or ideas, please let me know.
Inside a grunt task, you can get the name of the task currently run by using
this.name, but it doesn't work outside of task.
require'extend-grunt-api'grunt;grunt.logwritegrunttaskgetCurName; // you will get 'hello' if you run task with 'grunt hello'gruntregisterTask'hello'// sth todo;;