CSS Class Prefixer Plugin for webpack.
Automatically adds prefixes to CSS classes, for webpack.
const PrefixCssPlugin = require('@sjv/css-prefixer-plugin');
const prefixCss = new PrefixCssPlugin({
filePatterns: [
/\.css$/
],
cssPrefix: 'sjv-',
prefixElements: true
});
plugins: [
prefixCss,
...
]| option | type | values | required | usage |
|---|---|---|---|---|
filePatterns |
array |
true |
Array of regular expressions | |
cssPrefix |
string |
true |
Prefix to add to classes | |
prefixElements |
boolean |
true false Default: false |
false |
If styled elements should have the prefix appended. For instance, given prefix sjv-, body would become body.sjv. The dash is automatically removed |
fileSuffix |
string |
Default: -prefixed |
false |
With default setting, file name sjv-main.css would become sjv-main-prefixed.css |