1.0.0 • Published 2 years ago
@sika7/postcss-whitelist-sanitize v1.0.0
postcss-whitelist-sanitize
PostCSS plugin this postcss plugin whitelist filter. sanitize leaving the allowed properties and values..
.foo {
a: #eee; // <= remove unknown property.
background-color: hoge; // <= remove unknown value.
position: fixed; // <= remove not allowed property.
color: #eee;
}
.foo {
color: #eee;
}
Usage
Step 1: Install plugin:
npm install --save postcss postcss-whitelist-sanitize
Step 2: allow property config.
const opts = {
allowPropertys: ["background-color", "color"], // required
validationCheck: true,
allowPropertyCheck: true,
}
postcss([postcssWhitelistSanitize(opts)]).process()
config
default config.
{
allowPropertys: [], // all not allow propertys.
validationCheck: true, // default true.
allowPropertyCheck: true, // default true.
}
setting | description | default | example |
---|---|---|---|
allowPropertys | setting a allow propertys. | [] | "color","text-align" |
validationCheck | true is remove validation error property and value. General w3c style Guideline applies. Using ben-eb/css-values module. | true | |
allowPropertyCheck | true is remove not allow property. Using allowPropertys. | true |
1.0.0
2 years ago