-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Custom spacing without "full" does not merge while "auto" does #377
Comments
Hey @WesselKroos! 👋 I could reproduce it and indeed the issue is that tailwind-merge includes the I have to think about how to best fix this. The big question is whether tailwind-merge should favor being as close as possible to the Tailwind CSS config or prefer a smaller bundle size. Removing the |
Thanks for the explanation and the code links. I understand what you mean by "it would make the already quite large config even bigger than it is". Or alternatively, Or thinking even simpler, |
Oh yeah, you're right, the fractions have the same problem.
Yes, that idea is already floating around for some time. The problem with this is that I'd need to know from Tailwind which classes it produced. I asked for an API for that in tailwindlabs/tailwindcss#10348 but it's not possible to say if and when that would be built.
The full Tailwind CSS config is really big unfortunately, bigger than tailwind-merge itself. It's also not so easy to pass a Tailwind config to tailwind-merge because you'd need to pass scale values around manually quite often – tailwind-merge only allows to use a subset of all theme keys, the rest must be modified in the I don't recommend to go this route.
That is sort of happening already, but also not at the same time. tailwind-merge merges all values that look like they could be part of the default scale. E.g. The way to go with tailwind-merge with the least configuration issues is to configure Tailwind as close as possible to the default, meaning that you keep using numbers for number scales, T-Shirt sizes fort T-Shirt scales (you can use This is far from ideal, but probably the least painful way to do it until I figure out how to build the config automatically. |
That's great to hear. Let's hope that they implement such API soon.
That's unfortunate, then it makes sense that we will go the Thanks for your time, insights and the work on tailwind-merge! |
Describe the bug
Our tailwind config has a custom spacing without the Tailwind default "full" and "auto" spacings. But the "auto" spacing is correctly merged while the "full" spacing is not.
twMerge(...) Results:
To Reproduce
tailwind.config.js example:
Merge code example:
Steps to reproduce the behavior
https://codesandbox.io/p/sandbox/hungry-wu-636mq5?file=%2Fsrc%2Findex.ts
Expected behavior
I would expect the tailwind default
auto
andfull
spacings, that are both still available with a custom config, to behave the same in twMerge.Environment
Windows 11, Node 20.10.0
Additional context
We have temporarily fixed this bug by manually adding the
full
spacing to our extendTailwindMerge config.The text was updated successfully, but these errors were encountered: