broccoli-merge-json
v0.0.2
Published
Broccoloi plugin to merge multiple json files into one
Downloads
7
Readme
broccoli-merge-json
Merge multiple json files into one file.
Installation
npm install --save-dev broccoli-merge-json
Usage Example
var mergeJSON = require('broccoli-merge-json');
var jsonTree = mergeJSON(sourceTree, {
srcDir: '/languages',
destDir: '/assets/languages'
});
This would create a .json for each sub directory in /languages
. Each resulting
json file would contain the json files in the languages directory or any
sub directory.
The following directory structure
├─┬ languages
└─┬ en
├── index.json
├── global.json
├── header.json
├── components.json
└─┬ components
├── modal-dialog.json
└── date-selector.json
would result in the following en.json
:
{
// contents of index.json
"global": {
//contents of global.json
},
"header": {
//contents of header.json
},
"components": {
//contents of components.json
"modalDialog": {
//contents of modal-dialog.json
},
"dateSelector": {
//contents of date-select.json
}
}
}
Options
srcDir (required), destDir (required)
The destDir
directory will be created, and all subdirectories of srcDir
will result in a .json file in the destDir
.