1.0.3 • Published 3 years ago

locales-bundler v1.0.3

Weekly downloads
47
License
MIT
Repository
github
Last release
3 years ago

locales-bundler

npm CI

Script to merge deep hierarchy of JSON files into a flat set of objects (files) containing deep objects inside.

More "independent" version of the gulp-locales-bundler.

Check the Real Life Example to get more context for this script.

Quick Start

Install

Locally to use in runtime:

npm install locales-bundler

Or globally to use in CLI:

npm install -g locales-bundler

Use

Runtime

const localesBundler = require('locales-bundler');

// Gets all JSON files from 'locales' directories under the 'src' path,
// omits the 'locales' directory from the resulting objects (default is '').
const locales = localesBundler('src', 'locales/**/*.json', 'locales');

CLI

Can be used as part of the build process, writes merged JSON files to the destination dir.

locales-bundler -s src -p locales/**/*.json -o locales -d dist

Where -s is source, -p is pattern, -o is omit and -d is destination.