diff --git a/README.md b/README.md index a87831d0..7ccff29a 100644 --- a/README.md +++ b/README.md @@ -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)]], }); ``` diff --git a/docs/preprocessing.md b/docs/preprocessing.md index 6f88cca9..1f4d61cc 100644 --- a/docs/preprocessing.md +++ b/docs/preprocessing.md @@ -484,3 +484,5 @@ And the result, with a `NODE_ENV = 'production'` would be:

Production environment!

{/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`.