Import and generate classes inside specific Tailwind @layer #1885
Unanswered
alexanderkalachev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using postcss-import to import classes from separate file and I use my custom plugin to generate classes.
Both of this methods work, but using it with Tailwind is not quite.
Tailwind doesn't see those classes inside it's components layer and I cannot access them with @apply.
I reproduced similar to my setup in this repository: https://github.com/alexanderkalachev/postcss-generate-classes-in-tw-layers
It's Next.js app with PostCSS and Tailwind.
You can find two css files inside 'app' directory: globals.css and partial.css
I use postcss-import to include partial.css in globals.css.
Then I generate two additional classes with custom plugin in 'plugins/custom-plugin.js'.
Then inside globals.css I trying to access different classes inside components layer. Each class represent a way to add a component that doesn't work.
Thank you! Please, let me know if you can spot my mistake.
Beta Was this translation helpful? Give feedback.
All reactions