Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/transfigurify
Configure which browserify transforms get applied to your package via an environment variable.
https://github.com/thlorenz/transfigurify
Last synced: 15 days ago
JSON representation
Configure which browserify transforms get applied to your package via an environment variable.
- Host: GitHub
- URL: https://github.com/thlorenz/transfigurify
- Owner: thlorenz
- License: mit
- Created: 2014-01-27T16:07:28.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-28T17:29:24.000Z (almost 11 years ago)
- Last Synced: 2024-05-08T17:30:32.227Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 215 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transfigurify [![build status](https://secure.travis-ci.org/thlorenz/transfigurify.png)](http://travis-ci.org/thlorenz/transfigurify)
Configure which [browserify](https://github.com/substack/node-browserify) transforms get applied to your package via an environment variable.
#### package.json
```json
{
"browserify": {
"transform": [
"hbsfy",
"transfigurify"
]
},
"transfigurify": {
"test": [
"brfs"
]
},
"dependencies": {
"brfs": "0.0.9",
"hbsfy": "~0.1.3",
"transfigurify": "~0.1.0"
}
}
```In this configuration the `hbsfy` transform runs always, but the `brfs` transform is applied only if
`TRANSFIGURIFY_ENV=test`, i.e:TRANSFIGURIFY_ENV=test browserify main.js > bundle.js
## Examples
Please review and try this [full example](https://github.com/thlorenz/transfigurify/tree/master/example) to get a better
understanding of how transfigurify works.Reading the [tests](https://github.com/thlorenz/transfigurify/tree/master/test) is also benefitial to that end.
## Installation
npm install transfigurify
## API
transfigurify::envThe env variable which is used by transfigurify to determine which transforms config in the
package.json
to use
in order to apply transforms.You need to set this or provide it via the
TRANSFIGURIFY_ENV
environment variable.// setting from javascript
transfigurify.env = 'test';# setting from command line
TRANSFIGURIFY_ENV=test browserify -t transfigurify ...
transfigurify(file) → {TransformStream}browserify transform which applies a set of browserify transforms that are configured inside
package.json
.
Multiple sets can be configured and a matching one selected depending on theTRANSFIGURIFY_ENV
environment variable.This variable can also be set directly via
transfigurify.env='x'
.If no matching configuration is found or the environment variable wasn't set a through stream is returned which
means that the file will not be transformed by transfigurify.Parameters:
Name
Type
Description
file
string
file whose content is to be transformed
Returns:
transform that is composed of the transforms that were configured for the environment (if any)
Type
TransformStream*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT