envstatic-brunch
v0.1.0
Published
A Brunch plugin that replaces tokens with predefined variables.
Downloads
3
Readme
envstatic-brunch
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
- Add some tests
- Add some code
- Run
npm test
- 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 is a developer focused job platform. The names and logos for Honeypot are trademarks of Honeypot GmbH.