Giter Site home page Giter Site logo

broccoli-config-writer's Introduction

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;

broccoli-config-writer's People

Contributors

bajix avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.