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

Calculation of multiple theme() does not work in arbitrary properties #11034

Closed
Serator opened this issue Apr 19, 2023 · 3 comments
Closed

Calculation of multiple theme() does not work in arbitrary properties #11034

Serator opened this issue Apr 19, 2023 · 3 comments
Assignees

Comments

@Serator
Copy link

Serator commented Apr 19, 2023

What version of Tailwind CSS are you using?

v3.3.1

What build tool (or framework if it abstracts the build tool) are you using?

play.tailwindcss.com

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction URL

https://play.tailwindcss.com/1Z2PI86485

Describe your issue

The calc() function breaks when it has more than one occurrence of theme(). This only happens in arbitrary properties. In arbitrary values, everything works as expected.

I can't be 100% sure, but it seems to have worked in previous versions of Tailwind.

@misha-otto
Copy link

@adamwathan
Copy link
Member

For whoever gets a chance to hack on this — looks like a bug in our parser, specifically only happens when making theme calls with square brackets — can see it works here if the second theme call is using dot notation:

https://play.tailwindcss.com/LR1PXedstt

- <div class="h-10 w-[--test] bg-red-600 [--test:_calc(theme(spacing[5])_+_theme(spacing[5]))]"></div>
+ <div class="h-10 w-[--test] bg-red-600 [--test:_calc(theme(spacing[5])_+_theme(spacing.5))]"></div>

@RobinMalfait
Copy link
Contributor

This should be fixed by #11039, and will be available in the next release.

You can already try it by using the insiders build npm install tailwindcss@insiders.

Updated the Tailwind Play to use the latest insiders version to see the fix in action: https://play.tailwindcss.com/xc7YIpsV1f

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

4 participants