Uses String.prototype.replace to replace matched patterns.
npm install --save-dev broccoli-string-replace
Replace VERSION_STRING
with 1.6.5
in app/main.js
:
var replace = require('broccoli-string-replace');
var tree = replace('app', {
files: [ 'main.js' ],
pattern: {
match: /VERSION_STRING/g,
replacement: '1.6.5'
}
});
options.files
{Array}
The list of files to process the list of patterns against. This is an array of strings.
options.patterns
{Array}
A list of objects with match
and replacement
properties.
options.pattern
{Object}
A single pattern with match
and replacement
properties.
I know, right?
Running the tests:
npm install
npm test
This project is distributed under the MIT license.