Skip to content

cletusw/fallback-multi-json-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fallback keys & values for use with multi-json-loader

Install

npm install fallback-multi-json-loader

Usage

Documentation: Using loaders

Returns a single JSON blob with keys and values made by calling multi-json-loader then merging in the result of the following loaders using lodash merge. If two leaf nodes conflict, the one from the following loaders (from data/pt in the below example) wins.

./data/en/account.json

{
  "both-key1": "both-key1-en-value",
  "en-key1": "en-key1-value"
}

./data/pt/account.json

{
  "both-key1": "both-key1-pt-value",
  "pt-key1": "pt-key1-value"
}

example.js

var data = require('json-loader!fallback-multi-json-loader?cwd=data/en!multi-json-loader?cwd=data/pt!./irrelevant.whatever');
// => {
//   account: {
//     'both-key1': 'both-key1-pt-value',
//     'en-key1': 'en-key1-value',
//     'pt-key1': 'pt-key1-value'
//   }
// }

Options

Same as multi-json-loader.

License

MIT

About

Webpack loader to provide fallback keys & values for use with multi-json-loader

Resources

License

Stars

Watchers

Forks

Packages

No packages published