This is a validator to check that your css complains with BEM naming convention
Using npm:
$ npm install --save-dev bem-validator-loader
Using yarn
$ yarn add -D bem-validator-loader
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader', 'bem-validator-loader']
}
]
}
}
include
(exclude
) List of regular expressions of filepaths to validate (skip)
{
loader: "bem-validator-loader",
options: {
exclude: "/node_modules"
}
}
webpackDirectories
Callback to calculate list of directories for bem module checking
{
loader: "bem-validator-loader",
options: {
include: [/webpack\/pages/, /webpack\/common/],
webpackDirectories: fullpath => {
const dirs = fullpath.split('/')
const i = dirs.indexOf('webpack')
return dirs.filter((dir, I) => I > i +1 )
}
}
}
onError
Callback to catch errors. For example to replace all errors with warnings
{
loader: "bem-validator-loader",
options: {
onError: (error, options) => {
if (options.filename.match(/pages/indes.sass/)) options.this.emitWarning(error)
else throw new Error(error)
}
}
}
This is a fork of @torleif’s BEM (Block Element Modifier) Validation Service
which is forked from
This is a fork of @iamdustan’s iamdustan’s AST explorer
which is forked from
This is a fork of @fkling’s Esprima AST Explorer