-
-
Notifications
You must be signed in to change notification settings - Fork 78
composite class does not merge with individual class #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ref: cssnano/cssnano#1583 |
Hey! Yeah Tailwind CSS and tailwind-merge both rely heavily on the order of the CSS, so merging two Tailwind CSS stylesheets causes issues like this. When using an independent lib which has its own Tailwind config in a project with its own Tailwind config, the typical solution I'm aware of is to add a prefix to one of the two Tailwind configs. Then you can still merge classes between the two, see #537. |
Thanks for confirming that. It also means that when working on a monorepo containing multiple packages of components using the same prefix, I have to use the tailwind config One drawback is that it breaks the encapsulation on dependencies, i.e. we need to also update and include the transient dependencies. v3 can get around that by importing the |
You can still use a JS config in Tailwind CSS v4 → https://tailwindcss.com/docs/functions-and-directives#config-directive |
Yeah, but that's a temporary solution. Tailwind team said it will be removed in the future. |
Describe the bug
Hi @dcastil, this is sort of both a bug and a feature.
tailwind-merge
current behavior for merging composite class with their individual class like this:This works fine locally, I believe, even with this:
because
tailwind
will place the.p-0
class before.pl-1
class:However, it will not work when a Tailwind app consuming a Tailwind lib:
Since
p-0
appears inapp
, the resulting CSS:This cause
B
to rendered withp-0
instead ofpl-1
.PostCSS plugin
postcss-discard-duplicates
could not help here because it kept the last duplicate:One solution I can think of is transform
p0 pl-1
topr-0 pt-0 pb-0 pl-1
.But then
tailwind
couldn't generate the right classes.The text was updated successfully, but these errors were encountered: