https://github.com/statianzo/append-basename-webpack-plugin
Append to basenames before resolution in webpack
https://github.com/statianzo/append-basename-webpack-plugin
plugin webpack
Last synced: over 1 year ago
JSON representation
Append to basenames before resolution in webpack
- Host: GitHub
- URL: https://github.com/statianzo/append-basename-webpack-plugin
- Owner: statianzo
- License: isc
- Created: 2018-05-15T05:23:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-15T05:33:47.000Z (about 8 years ago)
- Last Synced: 2025-03-02T05:51:31.006Z (over 1 year ago)
- Topics: plugin, webpack
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# append-basename-webpack-plugin
[](https://travis-ci.org/statianzo/append-basename-webpack-plugin)
Append to basenames before resolution in webpack
`style.css` becomes `style.dark.css`
## Installation
Install the package
```sh
npm install --save-dev append-basename-webpack-plugin
```
Add the plugin to your webpack config `resolve.plugins`
```js
// webpack.config.js
const AppendBasenameWebpackPlugin = require('append-basename-webpack-plugin');
module.exports = {
resolve: {
plugins: [
new AppendBasenameWebpackPlugin({
append: '.dark'
})
]
}
}
```
## Options
- `include` - (Default: null) String or Array of patterns to include appending
- `exclude` - (Default: null) String or Array of patterns to exclude appending. *Takes priority over include*
- `append` - (Default: '') String to append to the basename of matched files
- `source` - (Default 'described-relative') Source hook to tap in enhanced-resolve's resolution
- `target` - (Default 'raw-file') Target hook to emit in enhanced-resolve's resolution
## Why?
Push conditionals to the configuration level by overwriting imports. For
example, theming with CSS modules.