Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 1.99 KB

README.md

File metadata and controls

71 lines (46 loc) · 1.99 KB

ember-cli-replace

Ember Observer Score

Ember CLI addon to replace text patterns in files. This is just a thin wrapper around outaTiME/applause.

Compatibility

  • Ember.js v3.24 or above
  • Ember CLI v3.24 or above
  • Node.js v12 or above

Installation

ember install ember-cli-replace

Usage

Define the source files that will be used for replacements, and patterns that will be used to replace the contents of source files.

The replacements are run post-build, so files should specify paths relative to the dist/ directory, not the app/ directory. Also note that during build templates are compiled to JavaScript, so you likely want to include **/*.js in the list, and probably don't need **/*.hbs.

var app = new EmberApp({
  replace: {
    files: ['index.html', '**/*.js'],
    patterns: [
      {
        match: 'foo',
        replacement: 'bar', // replaces "@@foo" to "bar"
      },
    ],
    enabled: true, // can be set to false to disable
  },
});

Options

Most options are passed directly to applause. For more information on these options, see applause.

Files

Type: Array Default: ['index.html', '**/*.js']

List of globs pointing to files to perform replacements in. Replacements are run after the build, so paths are relative to the dist/ directory.

Patterns

Type: Array Default: []

List of applause patterns used to perform replacements in source files.

Enabled

Type: Boolean Default: true

Enable string replacement during build.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.