Skip to content

Commit

Permalink
feat(options): add moduleFilename option (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell authored and evilebottnawi committed May 10, 2019
1 parent b0a0355 commit 13e9cbf
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 58 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ module.exports = {
};
```

#### Module Filename Option

With the `moduleFilename` option you can use chunk data to customize the filename. This is particularly useful when dealing with multiple entry points and wanting to get more control out of the filename for a given entry point/chunk. In the example below, we'll use `moduleFilename` to output the generated css into a different directory.

```javascript
const miniCssExtractPlugin = new MiniCssExtractPlugin({
moduleFilename: ({ name }) => `${name.replace('/js/', '/css/')}.css`
})
```

#### Long Term Caching

For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`.
Expand Down
Loading

0 comments on commit 13e9cbf

Please sign in to comment.