1.4.2 • Published 8 years ago

broccoli-config-writer v1.4.2

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

Broccoli Config Writer

A broccoli plugin for writing a subset of your config settings into an AMD & CommonJS compatible module.

The use case here is to create isomorphic config settings, such that your settings can be maintained a single place, complete with hierarchical overriding to allow for things such as environment specific settings.

Version npmSupport via GratipayNPM DownloadsBuild StatusDependencies

Install

NPM

Documentation

writeConfig(outputFile, options)

outputFile {String}

The file path to write your configuration to.

Supported extensions are .json and .js, which output JSON files or UMD modules, respectfully

options {Object}

Optional. This defaults to your config.browserConfig options, and is extended by the passed options. Hence, this can be entirely maintained solely within your config settings.

  • include {Array}

List of paths of config to include. Resolves deeply-nested object properties via dot or bracket-notation, and populates objects as needed. If omitted, clones config.

  • exclude {Array}

List of paths of config to exclude. Resolves deeply-nested object properties via dot or bracket-notation, and populates objects as needed

  • filter {function}

Callback function to modify config object directly. Optional.

Example

// .
// ├── config
// │   ├── default.json
// │   └── test.json

// default.json
// {
//   "hosts": { ... }
//   "facebook" { ... },
//   "browserConfig" : {
//     "include" : [
//       "hosts",
//       "facebook.appID",
//       "facebook.key"
//     ]
//   }
// }

var writeConfig = require('broccoli-config-writer'),
  mergeTrees = require('broccoli-merge-trees');

var coreAssets = 'assets';

var vendorAssets = 'vendor';

var assets = mergeTrees([
  writeConfig('config.js'),
  vendorAssets,
  coreAssets
], {
  overwrite: true
});

module.exports = assets;
1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.5

8 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago