Skip to content

Commit

Permalink
docs(replace): document the values option (#814)
Browse files Browse the repository at this point in the history
* [plugin-replace] Document the `values` option

* Fix example

* Update README.md

* Update README.md

* Update README.md
  • Loading branch information
nicolo-ribaudo authored Mar 10, 2021
1 parent 4f4c25d commit 8752c2f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/replace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,31 @@ Default: `null`

A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.

### `values`

Type: `{ [key: String]: Replacement }`, where `Replacement` is either a string or a `function` that returns a string.
Default: `{}`

To avoid mixing replacement strings with the other options, you can specify replacements in the `values` option. For example, the following signature:

```js
replace({
include: ["src/**/*.js"],
changed: "replaced"
});
```

Can be replaced with:

```js
replace({
include: ["src/**/*.js"],
values: {
changed: "replaced"
}
});
```

## Word Boundaries

By default, values will only match if they are surrounded by _word boundaries_.
Expand Down

0 comments on commit 8752c2f

Please sign in to comment.