-
Notifications
You must be signed in to change notification settings - Fork 42
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
Theme class name inconsistency with Tailwind #264
Comments
Update: some further experimentation on my end revealed that the problem wasn't with the Tailwind component itself, but probably due to a small incompatibility between tailwind itself and UnoCSS. My tailwind config had a color declaration like this in the reproduction: const theme = {
colors: {
"primary-accent": { DEFAULT: "#850c0c", contrast: "#fff" },
},
}; It works when I replace that with. const theme = {
colors: {
primaryAccent: { DEFAULT: "#850c0c", contrast: "#fff" },
},
}; If I want to use a classname like "text-primary-accent", tailwind expects me to use the former syntax (it doesn't automatically turn the classname into kebab-case), the later would result in me having to use "text-primaryAccent". Perhaps it might be good to put a disclaimer in the documentation that UnoCSS might need a slightly different configuration for the same functionality as plain Tailwind? I'm also thinking I might create an upstream bug in UnoCSS if Tailwind compatibility is something they claim to support out of the box, but I'm not sure about that (haven't spotted it from a quick glance at their website). Any insights from anyone here? |
Thanks for reporting this and the additional triage.
Yes, they have a preset that is supposed to be tailwind compatible. Here's a direct link to that preset: https://github.com/unocss/unocss/tree/main/packages/preset-wind We'll leave this open here, but it definitely looks like an upstream bug in unocss. They're pretty good about addressing bugs like these quickly, and I would encourage you to open an issue there as well. |
In the meantime I'm going to update us to the new v0.65.0 version that was released last week. |
@jsxp-email/cli
Version?: N/AExpected Behavior
The Tailwind component detects and renders the css for all classNames used in its children, even when those are abstracted into separate React Components.
Actual Behavior
The Tailwind component seems to only detect classNames used in its direct children.
Additional Information
I believe this bug report/feature request is a duplicate of #73, albeit simpler since there was also a React hook involved there. I hope by adding a reproduction case this time, we will have more success in helping us find a solution.
The text was updated successfully, but these errors were encountered: