gulp-merge-json
A gulp plugin for deep-merging multiple JSON files into one file. Export as JSON or a node module.
Usage
var merge = ; /* Basic functionality */gulp ; /* Edit JSON with function */gulp ; /* Provide a default object (files are merged in order so object values will be overwritten) */gulp ; /* Provide an overwriting object (merged at the end) */gulp ; /* Use module.exports */gulp ; /* Use a custom variable to prefix */gulp ; /* Provide options as an object*/gulp
Example Input
/* json/defaults.json */{ "key1": { "data1": "value1", "data2": "value2" }, "key2": { "dataA": "valueA", "dataB": { "a": "b", "c": "d" } }} /* json/development.json */{ "key1": { "data1": "devValue" }, "key2": { "dataB": { "c": "DEV MODE!" } }, "key3": { "important": "value" }}
Example Output
/* dist/combined.json */{ "key1": { "data1": "devValue", "data2": "value2" }, "key2": { "dataA": "valueA", "dataB": { "dataA": "valueA", "dataB": { "a": "b", "c": "DEV MODE!" } } }, "key3": { "important": "value" }}