grunt-json-extend
v0.0.5
Published
grunt plugin for generate extended json files.
Downloads
2
Readme
#grunt-json-extend
grunt plugin for generate extended json files.
install
npm install --save-dev grunt-json-extend
example
src
[
{
"foo": "bar"
}
]
dest
[
{
"foo": "bar",
"baz": "foobar"
}
]
usage
module.exports = function(grunt) {
grunt.initConfig({
jsonExtend: {
// add source json file here.
src: './json/test-before.json',
// add destination json file here.
dest: './json/test-after.json',
// write callback functions as array,
// to extend your object's property.
callbacks: [
function( obj ){
// obj is each object from src.
var result = 'foo' + '+' + obj.foo;
// return object, you want to add for json file.
return {
"baz": result
};
}
]
}
});
grunt.task.loadTasks("tasks");
grunt.registerTask( 'default', [ 'jsonExtend' ]);
};