Grunt's config methods, as a standalone library.
This is not ready for use yet! We'll update the readme when it's ready to go, feel free to star the project if you want updates in the meantime!
Install with npm
$ npm i grunt-legacy-config --save-dev
var config = require('grunt-legacy-config');
Get/set config data. If value was passed, set. Otherwise, get.
Params
prop
{String}value
{*}returns
{String}
Example
config([prop [, value]]);
Escape any .
in the given propString
with \.
This should be used for property names that contain dots.
Params
str
{String}: String with.
s to escapereturns
{String}
Example
config.escape('foo.js');
//=> 'foo\.js'
Return prop as a string. If an array is passed, a dot-notated string will be returned.
Params
prop
{String|Array}returns
{String}
Example
config.getPropString(['a', 'b']);
//=> 'a.b'
Get a raw value from the project's Grunt configuration, without processing <% %>
template strings.
Params
prop
{String}: The name of the property to get.returns
{*}: Returns the value of the given property.
Example
config.getRaw([prop]);
Get a value from the project's Grunt configuration, recursively processing templates.
Params
prop
{String}returns
{*}: Returns the value ofprop
Example
config.set('a', 'b');
var foo = config.get('a');
//=> 'b'
Expand a config value recursively. Used for post-processing raw values already retrieved from the config.
Params
str
{String}returns
{*}: Resolved config values.
Example
config.set('a', 'b');
config.set('x', 'z');
var foo = config.process('<%= a %>');
//=> 'b'
var bar = config.process(['<%= a %>', '<%= x %>']);
//=> ['a', 'z']
Set a value onto the project's Grunt configuration.
Params
prop
{String}: The property name.value
{*}: The value of the specified property
Example
config.set(prop, value);
Recursively merge properties of the specified configObject
into the current project configuration.
Params
obj
{Object}: The object to merge onto the project config.returns
{Object}: Returnsconfig.data
Example
config.init({
jshint: {
src: ['*.js']
}
});
// merge the following properties from the `jshint` object onto
// the `jshint` object in the above config
config.merge({
jshint: {
options: {...}
}
});
Test to see if required config params have been defined. If not, throw an exception (use this inside of a task). One or more config property names may be specified.
Params
props
{String|Array}: Property name as a string or array of property names.returns
{*}
Example
config.requires(prop [, prop [, ...]]);
First:
(loosely in this order...)
- migrate code
- migrate tests
- get tests passing with 100% parity
- add Grunfile
- coverage reports
- API documentation, written as code comments
- Add links to website docs for any methods that have more info
- Add the event to the changelogs of both libraries
Next:
- replace core
grunt.config
internal module withgrunt-legacy-config
- remove any dependencies that are no longer needed from grunt.
- enable travis
- add travis badge
- grunt: The JavaScript Task Runner
- grunt-cli: The grunt command line interface.
- grunt-legacy-log: The Grunt 0.4.x logger.
- grunt-legacy-util: Some old grunt utils provided for backwards compatibility.
Install dev dependencies:
$ npm install -d && grunt
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
"Cowboy" Ben Alman
Copyright (c) 2015 "Cowboy" Ben Alman Released under the MIT license.
This file was generated by verb-cli on May 14, 2015.