https://github.com/seebigs/bundl-replace
https://github.com/seebigs/bundl-replace
Last synced: about 12 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/seebigs/bundl-replace
- Owner: seebigs
- Created: 2017-01-13T07:53:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T19:37:01.000Z (about 8 years ago)
- Last Synced: 2025-08-09T02:48:48.550Z (10 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bundl-replace
*Replace strings within your bundles*
*Runs with the amazing [Bundl](https://github.com/seebigs/bundl) build tool*
## Install
```
$ npm install --save-dev bundl-replace
```
## Use
```js
var Bundl = require('bundl');
var write = require('bundl-write');
var replace = require('bundl-replace');
new Bundl(targets)
.then(replace(pattern, replacement))
.then(write())
.go();
```
## Arguments
Behave like [String.prototype.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) with the exception that String patterns are replaced globally
## Direct Replace
Sometimes it is desirable to do a direct string replace without converting to a RegEx. Note: this only replaces the first occurrence.
```js
var Bundl = require('bundl');
var write = require('bundl-write');
var replace = require('bundl-replace');
new Bundl(targets)
.then(replace.direct('(function(foo){', '(function(bar){'))
.then(write())
.go();
```