Postcss plugin which converts :matches() pseudo classes into :is() and reverse.
npm install postcss-matches-is-pseudo-classBy default:
``css
.foo:matches(:hover, :active) {
text-decoration: underline;
}
.bar:is(:hover, :active) {
text-decoration: underline;
}
`
becomes
`css
.foo:matches(:hover, :active) {
text-decoration: underline;
}
.foo:is(:hover, :active) {
text-decoration: underline;
}
.bar:matches(:hover, :active) {
text-decoration: underline;
}
.bar:is(:hover, :active) {
text-decoration: underline;
}
`{ preserve: true }options
$3
* With (default), both :is() and :matches() are kept/added{ preserve: false }
* With , renames :matches() to :is(){ preserve: "matches" }
* With , renames :is() to :matches()
Step 1: Install plugin:
`sh`
npm install --save-dev postcss postcss-matches-is-pseudo-class
Step 2: Check you project for existed PostCSS config: postcss.config.js"postcss"
in the project root, section in package.jsonpostcss
or in bundle config.
If you do not use PostCSS, add it according to [official docs]
and set this plugin in settings.
Step 3: Add the plugin to plugins list:
`diff``
module.exports = {
plugins: [
+ require('postcss-matches-is-pseudo-class')({ preserve: true }),
]
}