-
Notifications
You must be signed in to change notification settings - Fork 656
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
CSS variables defined in the template are substituted with undefined
when using Tailwind
#1448
Comments
Hmm, I don't remember we removed any
What Tailwind does is try resolving all CSS variables for the styles associated with each class, meaning that it couldn't find the variable you defined on the so it resolves to undefined. If there is even a style inside its scope, i.e., it's children. That's certainly an issue, but resolving these variables from outside the scope of the email template — assuming this is what you want — is going to be impossible currently. It's probably going to be better to, at least currently, use actual values as colors on your Tailwind config for the email template. Maybe have a |
That's what I've been doing but kinda sucks having to configure two separate tailwind.configs. Also, not sure if the issue name correctly represents the issue now. The problem seems to be with the <style> tags and not the css variables itself |
@wladpaiva Sadly no, it would only work if we inlined the styles after rendering, but we do it during rendering in the actual React elements for a few reasons.
Not sure if I follow what you mean here, but the issue here is with the CSS variables. If you define a CSS variable in your template and then use it through Tailwind somehow, they will not be resolved properly. Are you talking about another problem? |
Forget it. You are right. The problem is with the css variables and not the <style> being striped out before inlining the css. |
undefined
when using Tailwind
I was dealing with the same issue today, thank you for the PR. I am wondering, is there perhaps a rough estimate for when the PR above will be merged? 🙇 |
I am still having this issue, where my colors look like this
But ideally I would want to use the variables, is there a workaround on this rather than hardcoding the values? |
@paschalidi Are you still having it in canary? |
This is what I use. @gabrielmfern does this help? |
@paschalidi I see you aren't using the canaries. The issue here has been fixed on canaries. Canaries are a different tag of versions that we use that come before the stable version, sort of like a beta, meant for testing before the proper release. Try using |
ah I see! thank you, I will try that now 🙇 |
Thank you for this fix, it works now 🙇 |
Describe the Bug
Right now, if you want to use the same Shadcn styles in the react-email you have to duplicate the tailwind config file and manually replace the css variables with the actual values. Apparently react-email strip out
<style>
tags before transforming classnames to styles.Which package is affected (leave empty if unsure)
@react-email/tailwind, react-email
Link to the code that reproduces this issue
https://github.com/wladpaiva/react-email-shadcn
To Reproduce
bun dev
<Text>
elementsExpected Behavior
Both
<p>
s should have background set but only the one using the css variable is set to undefinedWhat's your node version? (if relevant)
No response
The text was updated successfully, but these errors were encountered: