-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
twMerge remove shadow color without reason #277
Comments
Hey @viktorbonino! 👋 Do you have a way to reproduce the issue you have? I just tried it out with https://codesandbox.io/s/tailwind-merge-playground-cssr35?file=/src/index.ts and const mergeData: MergeData[] = [
{
args: ['shadow-lg shadow-red-500'],
},
] but the result was |
I have this problem using tailwind-variants (that uses twMerge under the hood) and i assumed it was a twMerge bug, because if i disable twMerge within tailwind-variants it works. |
Ah, then you need to pass the tailwind-merge config to tailwind-variants which then passes that config to tailwind-merge. Here is the place where you need to pass the tailwind-merge config: https://www.tailwind-variants.org/docs/api-reference#twmergeconfig 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. |
For some reason I’m also having this in my project using |
Having the same issue with version |
@tom-ads I just figured this out.
I need to use
|
@G9000 you generally don't need to configure colors in tailwind-merge. tailwind-merge will detect all classes that look like color classes and are not known to tailwind-merge as color classes. twMerge('text-my-custom-red text-xl text-another-custom-color') === 'text-xl text-another-custom-color' |
Same here with arbitrary values: |
Describe the bug
If you have both a shadow (shadow-lg for example) and a shadow color (shadow-red-500 for example) it removes the shadow color class even if it's not necessary.
The text was updated successfully, but these errors were encountered: