broccoli-string-replace
Broccoli plugin to replace a matched string with a replacement.
Last updated 6 years ago by rwjblue .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install broccoli-string-replace 
SYNC missed versions from official npm registry.

Broccoli's String Replace

Build Status

Summary

Uses String.prototype.replace to replace matched patterns.

Installation

npm install --save-dev broccoli-string-replace

Usage

Files

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'
  }
});

Documentation

replace(inputTree, options)


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.

ZOMG!!! TESTS?!?!!?

I know, right?

Running the tests:

npm install
npm test

License

This project is distributed under the MIT license.

Current Tags

  • 0.1.2                                ...           latest (3 years ago)

5 Versions

  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago

Copyright 2014 - 2016 © taobao.org |