Skip to content

Commit

Permalink
docs: add note about replace preprocessor to replace all occurences (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Feb 8, 2022
1 parent 881f3c9 commit 5db27a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -152,7 +152,7 @@ In example, to replace inject the value of `process.env.NODE_ENV`:

```js
autoPreprocess({
replace: [['process.env.NODE_ENV', JSON.stringify(process.env.NODE_ENV)]],
replace: [[/process\.env\.NODE_ENV/g, JSON.stringify(process.env.NODE_ENV)]],
});
```

Expand Down
2 changes: 2 additions & 0 deletions docs/preprocessing.md
Expand Up @@ -484,3 +484,5 @@ And the result, with a `NODE_ENV = 'production'` would be:
<h1>Production environment!</h1>
{/if}
```

> Note: a string can be used instead of a `RegExp`, but only a single occurence of it will change, as per the default behavior of `String.prototype.replace`.

0 comments on commit 5db27a3

Please sign in to comment.