@jerexyz/postcss-plugin-prefix

1.0.0 • Public • Published

PostCSS Plugin Prefix

PostCSS plugin postcss plugin for add css prefix.

/* Input example */
a {
}
.ant-test {
}
/* Output example */
#test a {
}
#test .ant-test {
}

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('@jerexyz/postcss-plugin-prefix')({
+      prefix: '#test',
+      matchRule: (selector) => {
+        if (/^.ant/.test(selector)) {
+          return true;
+        }
+        if (!/^[.#]/.test(selector)) {
+          return true;
+        }
+        return false;
+      },
+    }),
    require('autoprefixer')
  ]
}

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

Package Sidebar

Install

npm i @jerexyz/postcss-plugin-prefix

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.56 kB

Total Files

6

Last publish

Collaborators

  • jerexyz