Grunt exposes all of its methods and properties on the grunt
object that gets passed into the module.exports
function exported in your Gruntfile, Grunt plugin or in a tasks file.
Nearly all of the following methods are defined elsewhere, but are provided directly on the grunt
object for convenience. See the individual api section docs for detailed explanations and examples.
This method is an alias for the grunt.config.init method.
This method is an alias for the grunt.task.registerTask method.
This method is an alias for the grunt.task.registerMultiTask method.
This method is an alias for the grunt.task.renameTask method.
This method is an alias for the grunt.task.loadTasks method.
This method is an alias for the grunt.task.loadNpmTasks method.
This method is an alias for the grunt.fail.warn method.
This method is an alias for the grunt.fail.fatal method.
Retrieve the value of a command-line option, eg. debug
. Note that for each command-line option, the inverse can be tested, eg. no-debug
.
grunt.option(optionName)
The current Grunt package.json
metadata, as an object.
grunt.package
The current Grunt version, as a string. This is just a shortcut to the grunt.package.version
property.
grunt.version