Skip to content
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 calc with more than 2 theme keywords #831

Open
ajmnz opened this issue Sep 30, 2023 · 1 comment
Open

CSS calc with more than 2 theme keywords #831

ajmnz opened this issue Sep 30, 2023 · 1 comment

Comments

@ajmnz
Copy link
Contributor

ajmnz commented Sep 30, 2023

👋 @ben-rogerson

Looks like twin.macro isn't parsing more than 2 theme keywords inside CSS calc.

// The following
tw="w-[calc(theme(spacing.56) + theme(spacing.56) + theme(spacing.56))]"
// outputs { width: "calc(14rem + 14rem + theme(spacing.56))" }

// While something like the following
tw="w-[theme(spacing.56)] h-[theme(spacing.56)] px-[theme(spacing.56)]"
// correctly outputs { height: "14rem", width: "14rem", paddingLeft: "14rem", paddingRight: "14rem" }

Thank you!


Edit: Just noticed that this isn't only in calc.

tw="shadow-[theme(spacing.56) theme(spacing.56) theme(spacing.56) theme(spacing.56) #000]"
// Will output { "--tw-shadow-color": "14rem 14rem theme(spacing.56) theme(spacing.56) #000", "--tw-shadow": "var(--tw-shadow-colored)" }
@ben-rogerson
Copy link
Owner

Thanks for posting about this issue.
I've compared it to vanilla tailwind and found it's working there (with the underscores in place of spaces) so it should also work in twin - I'll get this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants