vue-component-compiler icon indicating copy to clipboard operation
vue-component-compiler copied to clipboard

PostCSS 8 deprecates `postcss.plugin`

Open halostatue opened this issue 4 years ago • 1 comments

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.

halostatue avatar Feb 15 '21 05:02 halostatue

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

lgollut avatar Apr 22 '22 06:04 lgollut