0.1.0 • Published 8 years ago

envstatic-brunch v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

envstatic-brunch

Build Status

A Brunch plugin that replaces tokens with predefined variables.

Usage

When you want to have a variable to be injected into your js files durring build time.

npm install --save-dev envstatic-brunch

// app.js
var app_host = $ENVSTATIC_APP_HOST;
## brunch-config.coffee
exports.config =
  # ...
  plugins:
    envstatic:
      ## variables to be substitued
      variables:
        APP_HOST: process.env.APP_HOST

will replace the envstatic placeholder with value configured in your brunch-config file.

// app.js
var app_host = 'app.example.com';

Options

Optional You can override envstatic-brunch's default options by updating your config.coffee with overrides.

These are the default settings:

exports.config =
  # ...
  plugins:
    envstatic:
      ## Placeholder prefix to be concatinated with variable names
      prefix: '$ENVSTATIC_'
      ## A RegExp where the first subgroup matches the token to be replaced
      pattern: /\$ENVSTATIC_(\w+)/gi
      ## RegExp that matches files that contain filename references.
      referenceFiles: /\.js$/
      ## variables to be substitued
      variables: {}

Contributing

  1. Add some tests
  2. Add some code
  3. Run npm test
  4. Send a pull request

License

Copyright © 2016 Honeypot GmbH. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About Honeypot

Honeypot

Honeypot is a developer focused job platform. The names and logos for Honeypot are trademarks of Honeypot GmbH.