Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

PostCSS 8 deprecates postcss.plugin #110

Open
halostatue opened this issue Feb 15, 2021 · 1 comment · May be fixed by #127
Open

PostCSS 8 deprecates postcss.plugin #110

halostatue opened this issue Feb 15, 2021 · 1 comment · May be fixed by #127

Comments

@halostatue
Copy link

I’m running with rollup-plugin-vue and vue-component-compiler provides a plugin, postcss-clean that causes this message to be output:

clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration

This appears to work fine for now, but the API used on postcss-clean.ts:6 is deprecated.

@lgollut
Copy link

lgollut commented Apr 22, 2022

Since this package is unlikely to be patched, I used https://www.npmjs.com/package/patch-package to silence the warning

-exports.default = postcss.plugin('clean', (options) => {
+exports.default = (options) => {
     const clean = new CleanCSS(Object.assign({ compatibility: 'ie9' }, options));
-    return (css, res) => {
+    return {
+      postcssPlugin: 'clean',
+      Once(css, res) {
         const output = clean.minify(css.toString());
         res.root = postcss.parse(output.styles);
+      },
     };
-});
+};
+exports.postcss = true

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants