This webpack plugin allows you to lint your CSS/SASS/SCSS/LESS etc. files through any version of Stylelint. It is heavily inspired by stylelint-webpack-plugin
with the key difference being that stylelint
isn't included in this package, allowing you to use any version you want instead of waiting on the webpack plugin to be updated to the newest version.
Compatibility
Version ^1.0.0
of this plugin is compatible with webpack ^4.0.0
. If you're using an older version of webpack, make sure to install the ^0.1.0
(npm install stylelint-bare-webpack-plugin@^0.1.0
) release of this plugin.
npm install stylelint-bare-webpack-plugin stylelint --save-dev
// webpack.config.js
const StylelintBarePlugin = require('stylelint-bare-webpack-plugin');
module.exports = {
// ...
plugins: [
new StylelintBarePlugin({
// Optional options object
})
]
}
You can pass an object containing several options to StylelintBarePlugin()
, this object can contain the following keys and any key that can be passed to stylelint as well.
Option | Default | Description |
---|---|---|
files |
'**/*.s?(c|a)ss' |
glob used for finding the files that will be linted |
emitErrors |
true |
Whether to emit webpack errors or only warnings, note that all stylelint errors will still be shown when disabling this |
failOnError |
false |
Whether to stop the entire Webpack process when a stylelint error is found |
formatter |
stringFormatter from Stylelint |
Formatter used to display warnings/errors in console |