postcss / postcss-use

Enable PostCSS plugins directly in your stylesheet.
MIT License
153 stars 11 forks source link

Plugin seems to be broken on PostCSS 8 #43

Open weaversam8 opened 3 years ago

weaversam8 commented 3 years ago

This plugin doesn't seem to function properly on PostCSS major version 8. In tailwindlabs/tailwindcss#5429 we attempted to create a minimal reproduction case, but we were unable to get the plugin to work at all.

ben-eb commented 3 years ago

Hey @weaversam8,

I'm not sure this is an easy fix due to PostCSS 8's new internals. Essentially this module used to call into PostCSS to adjust the plugins list at runtime, and this worked because plugins were applied in sequence to the file.

With the new setup I am not sure that this is possible. We would probably want a way to run this plugin first before all other plugins to achieve this.

Perhaps @ai has some insights?

Thanks for reporting this! 🙂

ai commented 3 years ago

You can create Once event handler where you will walk through the AST manually and enable plugins by directly working with result.processor.