Skip to content

Commit 8752c2f

Browse files
docs(replace): document the values option (#814)
* [plugin-replace] Document the `values` option * Fix example * Update README.md * Update README.md * Update README.md
1 parent 4f4c25d commit 8752c2f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/replace/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,31 @@ Default: `null`
114114

115115
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.
116116

117+
### `values`
118+
119+
Type: `{ [key: String]: Replacement }`, where `Replacement` is either a string or a `function` that returns a string.
120+
Default: `{}`
121+
122+
To avoid mixing replacement strings with the other options, you can specify replacements in the `values` option. For example, the following signature:
123+
124+
```js
125+
replace({
126+
include: ["src/**/*.js"],
127+
changed: "replaced"
128+
});
129+
```
130+
131+
Can be replaced with:
132+
133+
```js
134+
replace({
135+
include: ["src/**/*.js"],
136+
values: {
137+
changed: "replaced"
138+
}
139+
});
140+
```
141+
117142
## Word Boundaries
118143

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

0 commit comments

Comments
 (0)