Skip to content

Commit

Permalink
version 2.0.0; readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
Va1 committed Feb 25, 2018
1 parent a5321d0 commit 9a9dc4e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ Perform replacements (plain and regular expression) in the contents loaded by th
$ npm install --save-dev string-replace-loader
```

With release of 2.0.0 the loader is expected to be used in Node v4+ environment.
Support for Node v3 and lower was dropped, but you can install and use the loader version of 1.3.0 in older environments.

## Usage:

In general, loader allows to perform replacements in a way [String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) does (loader uses it internally). For instance, it means that if you want to replace all occurences, you should use RegExp in `query.search` with `g` flag in `query.flags`, etc.
In general, loader allows to perform replacements in a way [String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) does (loader uses it internally).
For instance, it means that if you want to replace all occurrences, you should use RegExp-like string in `query.search` with `g` flag in `query.flags`, etc.

### Plain replacement:

Expand All @@ -23,7 +27,7 @@ module.exports = {
loaders: [
{
test: /fileInWhichJQueryIsUndefined\.js$/,
loader: 'string-replace',
loader: 'string-replace-loader',
query: {
search: 'jQuery',
replace: 'window.$'
Expand All @@ -49,7 +53,7 @@ module.exports = {
loaders: [
{
test: /fileInWhichJQueryIsUndefined\.js$/,
loader: 'string-replace',
loader: 'string-replace-loader',
query: {
search: 'jquery',
replace: 'window.$',
Expand All @@ -74,7 +78,7 @@ module.exports = {
loaders: [
{
test: /\.js$/,
loader: 'string-replace',
loader: 'string-replace-loader',
query: {
multiple: [
{ search: 'jQuery', replace: 'window.$' },
Expand All @@ -100,7 +104,7 @@ module.exports = {
loaders: [
{
test: /fileInWhichJQueryIsUndefined\.js$/,
loader: 'string-replace',
loader: 'string-replace-loader',
query: {
search: 'jQuery',
replace: 'window.$',
Expand Down
1 change: 1 addition & 0 deletions node_modules/__this-loader/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "string-replace-loader",
"version": "1.3.0",
"version": "2.0.0",
"description": "Replace loader for Webpack",
"keywords": [
"webpack",
Expand Down

0 comments on commit 9a9dc4e

Please sign in to comment.