grunt.config: read and write config values grunt.event: listen and emit global events *grunt.fail: all about failling your tasks grunt.file: reading/writing files to disk (yaml and json support) *grunt.log: better accessor for the stdout (write vs. writeln, grunt.verbose) grunt.option: shared parameters (typically CLI flags) *grunt.task: loading and registering tasks grunt.template: wrapper around Lo-Dash template engine grunt.utils: … (error, linefeed, callbacks, etc)
one. puts grunt in wait mode. *this.requires(tasks[]): tells grunt this task needs success from other previously executed tasks *this.requiresConfig(prop…): validates presence of config properties this.name: the current name of the task, as defines by the register/rename call this.nameArgs: the full name, with the target and args, as from the CLI this.args: the CLI args, as an array *this.flags: the CLI args, as an object this.errorCount: the number of grunt.log.error calls during current execution *this.options([defaults]): merges the options objects with the provided defaults. returns the new options object.
By default, grunt runs all targets. grunt task:test # will only run the test target *this.target: the name of the currently running target this.files: flat array of all expanded path to all files *this.filesSrc: flat array of all expanded path to source files this.data: raw data object. Use files and filesSrc is recommanded Recommanded reading: Configuring tasks, file formats, pattern matching http://gruntjs.com/configuring-tasks#files
with initConfig(); // gruntfile.js grunt.initConfig({ task: { dev: {}, prod: {}, ... } }); Any name can be used, except options which is reserved by grunt.
standard looking gruntfile.js /*global module*/ module.exports = function (grunt) { 'use strict'; grunt.initConfig({...}); grunt.loadNpmTasks('grunt-plugin'); grunt.registerTask('default', ['my-task']); }; This is all you need to run existing tasks!
very possible values are declared and/or documented in code. https://github.com/DeuxHuitHuit/grunt-contrib-analyze- css/blob/master/tasks/analyze-css.js#L20-L59