postcss-sayonara

PostCSS plugin to limit used declarations to a given set

Usage no npm install needed!

<script type="module">
  import postcssSayonara from 'https://cdn.skypack.dev/postcss-sayonara';
</script>

README

PostCSS Sayonara

PostCSS plugin to limit used declarations to a given set.

.foo {
  /* Input example */
  fill: #fff;
  cursor: pointer;
}
.foo {
  /* Output example */
  fill: #fff;
}

Usage

Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you already use PostCSS, add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-sayonara')({
+     allowedPropNames: [
+       'stroke', 'stroke-width', 'stroke-opacity', 'stroke-dasharray',
+       'stroke-dashoffset', 'stroke-linecap',
+       'stroke-linejoin', 'stroke-miterlimit',
+       'fill', 'fill-rule', 'fill-opacity',
+       'clip-path', 'mask',
+       'opacity', 'color', 'stop-color', 'stop-opacity',
+       'font-family', 'font-size', 'font-weight',
+       'text-anchor', 'visibility', 'display',
+     ],
+   }),
    require('autoprefixer'),
  ],
}

If you do not use PostCSS, add it according to official docs and set this plugin in settings.