relateiq/browserify-swap

Name: browserify-swap

Owner: SalesforceIQ

Description: A transform that swaps out modules according to a config in your package.json selected via an environment variable.

Created: 2015-05-20 18:24:47.0

Updated: 2015-05-20 18:24:47.0

Pushed: 2015-04-20 16:36:57.0

Homepage:

Size: 240

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

browserify-swap build status

swap/swäp/ - an act of exchanging one thing for another

A transform that swaps out modules according to a config in your package.json selected via an environment variable.

package.json

rowserify": {
"transform": [ "browserify-swap" ]

rowserify-swap": {
"@packages": [ "hyperwatch" ],
"dev": {
  ".*node_modules\/hyperwatch\/\\S+\\.js$": "./swap/some-hyperwatch-swap.js",
  "util.js$": "myutil"
},
"test": {
  "util.js$": "test-util"
}


SERIFYSWAP_ENV='dev' browserify . -o bundle.js
Installation
npm install browserify-swap
API

browserifySwap(file) → {TransformStream}

Looks up browserify_swap configuratios specified for the given file in the environment specified via BROWSERIFYSWAP_ENV.

If found the file content is replaced with a require statement to the file to swap in for the original. Otherwise the file's content is just piped through.

Parameters:
Name Type Description
file String

full path to file being transformed

Source:
Returns:

transform stream into which browserify will pipe the original content of the file

Type
TransformStream
*generated with [docme](https://github.com/thlorenz/docme)*
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.