Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

docs(README): add regExp option (options.regExp) #244

Merged
merged 4 commits into from
Feb 14, 2018
Merged

docs(README): add regExp option (options.regExp) #244

merged 4 commits into from
Feb 14, 2018

Conversation

serut
Copy link
Contributor

@serut serut commented Feb 8, 2018

Hello,

This PR describes the behavior of regExp and how to use it.
I've also fix :

  • the type of the placeholder [N], hope this doesn't alter too much your table layout.
  • regExp is not a query parameter, it's an option. Moreover, passing a regExp as a query param is not a good idea, escaping is way too complicated.

Hope you will like it. 😄

@jsf-clabot
Copy link

jsf-clabot commented Feb 8, 2018

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serut Thx in advance

README.md Outdated
@@ -197,6 +198,25 @@ import img from './file.png'
`${publicPath}/0dcbbaa701328e351f.png`
```

### `regExp`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this after name

README.md Outdated
|**`useRelativePath`**|`{Boolean}`|`false`|Should be `true` if you wish to generate a `context` relative URL for each file|
|**`emitFile`**|`{Boolean}`|`true`|By default a file is emitted, however this can be disabled if required (e.g. for server side packages)|
|**`regExp`**|`{RegExp}`|`'undefined'`|Let you extract some parts of the file path to reuse them in the `name` property|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this after name

README.md Outdated
@@ -106,7 +107,7 @@ You can configure a custom filename template for your file using the query param
|**`[name]`**|`{String}`|`file.basename`|The basename of the resource|
|**`[path]`**|`{String}`|`file.dirname`|The path of the resource relative to the `context`|
|**`[hash]`**|`{String}`|`md5`|The hash of the content, hashes below for more info|
|**`[N]`**|`{Number}`|``|The `n-th` match obtained from matching the current file name against the query param `regExp`|
|**`[N]`**|`{String}`, with `N` `{Number}` >0 |``|The `n-th` match obtained from matching the current file name against the `regExp`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is actually a {String} e.g '4' instead of a {Number}, that should be sufficient for the type column imho. You could add a note in the description that N should be > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you need to write [4], [ and ] decorates the number. And explaining why N is a number > 0 is quite long and already explained on the regExp option. Maybe a link above "N {Number} >0"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, just {String} then please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oki that's not big deal

}
}
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// The interpolated name here ...

@michael-ciniawsky michael-ciniawsky changed the title Improve regExp documentation docs(README): add regExp option (options.regExp) Feb 9, 2018
@alexander-akait
Copy link
Member

@michael-ciniawsky friendly ping

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serut Thx

@michael-ciniawsky michael-ciniawsky merged commit 9ee8332 into webpack-contrib:master Feb 14, 2018
@michael-ciniawsky michael-ciniawsky removed this from the 1.1.8 milestone Feb 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants