Packageable, composable grunt configuration modules
Source: lib/grunt-horde/index.js
- exports.GruntHorde
- exports.create
- exports.extend
- GruntHorde
- GruntHorde.prototype.attack
- GruntHorde.prototype.home
- GruntHorde.prototype.kill
- GruntHorde.prototype.learn
- GruntHorde.prototype.loot
- GruntHorde.prototype.demand
Reference to GruntHorde.
Create a new GruntHorde.
Parameters:
{object} grunt
Instance injected into Gruntfile.js
Return:
{object}
Extend GruntHorde.prototype.
Parameters:
{object} ext
Return:
{object}
Merge result.
GruntHorde constructor.
Usage:
// Gruntfile.js
module.exports = function(grunt) {
require('grunt-horde')
.create(grunt)
.loot('my-base-config-module')
.loot('./config/grunt')
.attack();
};
Properties:
{object} config
Gruntfile.js values indexed bygrunt
method name{object} initConfig
{object} loadNpmTasks
{object} loadTasks
{object} registerMultiTask
{object} registerTask
{object} frozenConfig
Trackconfig
keys set inGruntfile.js
- Allow client project to override defaults set in modules.
- Keys:
config
key names, values: not used
{string} [home=process.cwd]
Absolute path to project root dir w/out trailing slash{object} grunt
Instance injected into Gruntfile.js{array} lootBatch
Pending merge functions collected in Gruntfile.prototype.loot
Go: TOC
Apply configuration.
Run all supported grunt
configuration methods.
Go: TOC | GruntHorde.prototype
Set working directory used to resolve relative paths.
Parameters:
{string} cwd
Return:
{object}
this
Go: TOC | GruntHorde.prototype
Remove a configuration property. Supports
x.y.z
property paths.
Usage:
horde.demand('initConfig.x', 20);
horde.kill('initConfig.x');
console.log(grunt.config.getRaw().x); // undefined
console.log(horde.learn('initConfig.x')); // undefined
Emits:
grunt-horde:kill
on every invocation.
Parameters:
{string} key
<section>.<key>- Ex.
initConfig.x.y.z
,registerTask.default
, etc. - Sections: initConfig, loadNpmTasks, loadTasks, registerTask, registerMultiTask
- Ex.
Return:
{object}
this
See:
Go: TOC | GruntHorde.prototype
Get a configuration property. Supports
x.y.z
property paths.
Usage:
horde.demand('initConfig.x.y.z', 20);
horde.learn('initConfig.x.y.z'); // 20
Parameters:
{string} key
<section>.<key>- Ex.
initConfig.x.y.z
,registerTask.default
, etc. - Sections: initConfig, loadNpmTasks, loadTasks, registerTask, registerMultiTask
- Ex.
Return:
{mixed}
Go: TOC | GruntHorde.prototype
Load a config module. Merge in its payload.
- Merge operation is deferred until GruntHorde.prototype.attack.
- Payloads are merged recursively, last wins.
- Loads
tasks/
, if present, withgrunt.loadTasks
.
Supported module types:
- Name of locally installed NPM package
- Relative path, ex.
./config/grunt/
- Absolute path
Usage:
horde.home('/proj/home');
horde.loot('base'); // require('/proj/home/node_modules/base');
horde.loot('./base'); // require('/proj/home/base.js');
horde.loot('/path/to/base'); // require('/path/to/base');
Example layout:
initConfig/
index.js
eslint.js
uglify.js
shell.js
tasks/
precommit.js
loadTasks.js
loadNpmTasks.js
registerTask.js
registerMultiTask.js
Parameters:
{string} name
Module path, seeUsage
above for examples
Return:
{object}
this
See:
Go: TOC | GruntHorde.prototype
Set a configuration property. Supports
x.y.z
property paths.
Usage:
horde.demand('x.y.z', 20);
console.log(horde.learn('x.y.z')); // 20
console.log(grunt.config.getRaw().x.y.z); // 20
Emits:
grunt-horde:demand
on every invocation.
Parameters:
-
{string} key
<section>.<key>- Ex.
initConfig.x.y.z
,registerTask.default
, etc. - Sections: initConfig, loadNpmTasks, loadTasks, registerTask, registerMultiTask
- Ex.
-
{mixed} val
Return:
{object}
this
See:
Go: TOC | GruntHorde.prototype
—generated by apidox—