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

Commit

Permalink
feat: added documentation for the postTransformPublicPath option
Browse files Browse the repository at this point in the history
  • Loading branch information
fabb committed Jul 22, 2019
1 parent 584f7d9 commit 64f2eb6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -269,6 +269,32 @@ module.exports = {
};
```

### `postTransformPublicPath`

Type: `Function`
Default: `undefined`

Specifies a custom function to post-process the generated public path. This can be used to prepend or append dynamic global variables that are only available at runtime, like `__webpack_public_path__`. This would not be possible with just `publicPath`, since it stringifies the values.

**webpack.config.js**

```js
module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|gif)$/,
loader: 'file-loader',
options: {
publicPath: '/some/path/',
postTransformPublicPath: (p) => `__webpack_public_path__ + ${p}`,
},
},
],
},
};
```

### `context`

Type: `String`
Expand Down
1 change: 1 addition & 0 deletions src/options.json
Expand Up @@ -35,6 +35,7 @@
]
},
"postTransformPublicPath": {
"description": "A custom transformation function for post-processing the publicPath (https://github.com/webpack-contrib/file-loader#posttransformpublicpath).",
"instanceof": "Function"
},
"context": {
Expand Down

0 comments on commit 64f2eb6

Please sign in to comment.