-
-
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 tailwind classes are conflicting with tailwind classes #250
Comments
Hey @zeckdude! 👋 If you use custom classes, you need to configure tailwind-merge to know about it. I wrote a recipe how to handle cases where you want to By the way in case you weren't aware, you can also add custom line-heights to your font-size classes in the Tailwind config: https://tailwindcss.com/docs/font-size#providing-a-default-line-height. Related: #207 |
Hey @ng-hai! 👋 Did you add the custom font sizes to your tailwind-merge config (e.g. in your |
Yes, in the example above, the custom font sizes are If I change to arbitrary value classes, the issue is gone |
Ah I think you're mixing up the Tailwind config and the tailwind-merge config. tailwind-merge needs to be configured separately because it doesn't have access to the Here is an example on how to configure tailwind-merge: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/recipes.md#adding-custom-scale-from-tailwind-config-to-tailwind-merge-config. And here is the documentation on how the tailwind-merge configuration works: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md#usage-with-custom-tailwind-config. You basically need to create a file where you create your own import { extendTailwindMerge } from 'tailwind-merge'
export const twMerge = extendTailwindMerge({
// your config here
}) |
Thanks a lot @dcastil, that helps me solve the issue. |
Describe the bug
When I create custom classes in tailwind and use them in the same
twMerge
call, they conflict with an existing tailwind class. As an example, here's the classes I'm adding:Then when I use
twMerge
as so:In this case the
text-yellow-500
class is not being used. I've determined that having the wordtext
at the beginning of the custom classes makes it clash.To Reproduce
Visit this sandbox to see it in action.
Expected behavior
I expected both classes to be used since they don't actually affect the same styling
Environment
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: