Generate incremental class name for css loader
npm install webpack-incremental-identrequire/import.
bash
$ npm install webpack-incremental-ident --save-dev
`
Via yarn:
`bash
$ yarn add -D webpack-incremental-ident
`
$3
`js
const IncrementalCSS = require('webpack-incremental-ident');
const webpackConfig = {
...
module: {
rules: [
{
test: /\.css$/,
loader: 'css-loader',
options: {
getLocalIdent: IncrementalCSS.getLocalIdent,
}
}
]
},
plugins: [
new IncrementalCSS({
logPath: path.resolve(__dirname, '../stats/css.json'),
blacklist: [/^ad$/]
})
]
}
`
$3
`js
new IncrementalCSS(options);
`
#### options.logPath
- Type: String
- Required
Path to your json file to keep track of your incremental class names.
#### options.characters
- Type: Array
- Default: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_
Characters are included in class names.
#### options.fallbackIdent
- Type: String
- Default: ""
Fallback to an ident name strategy if classname doesn't exist in logPath
#### options.blacklist
- Type: Array of regex
- Default: []
List of class names will be ignored for example ad`