https://github.com/webpro/versionify
Browserify transform to replace placeholder with package version
https://github.com/webpro/versionify
Last synced: about 1 year ago
JSON representation
Browserify transform to replace placeholder with package version
- Host: GitHub
- URL: https://github.com/webpro/versionify
- Owner: webpro
- Created: 2014-11-18T21:34:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-17T19:45:51.000Z (almost 11 years ago)
- Last Synced: 2025-02-27T18:27:06.742Z (about 1 year ago)
- Language: JavaScript
- Size: 163 KB
- Stars: 33
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# browserify-versionify
Browserify transform to replace placeholder with package version.
By default, it replaces `__VERSION__` with the version from `package.json` in your source code. E.g. before:
```js
var version = '__VERSION__';
```
after:
```js
var version = '1.0.0';
```
## Usage
From command line:
browserify -t browserify-versionify
From Node.js:
browserify().transform('browserify-versionify');
// Configure (default values shown)
browserify().transform('browserify-versionify', {
placeholder: '__VERSION__',
version: pkg.version
});
You can also provide a `filter` property to whitelist files to apply the transform to (e.g. `filter: /\.js$/`).
You can also add the transform to your `package.json`:
```json
{
"browserify": {
"transform": [
"browserify-versionify"
]
}
}
```