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

theme keys with dashes wrongly normalized in calc() #11704

Closed
wongjn opened this issue Jul 27, 2023 · 1 comment · Fixed by #11705
Closed

theme keys with dashes wrongly normalized in calc() #11704

wongjn opened this issue Jul 27, 2023 · 1 comment · Fixed by #11705
Assignees

Comments

@wongjn
Copy link
Contributor

wongjn commented Jul 27, 2023

What version of Tailwind CSS are you using?

v3.3.3

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

PostCSS 8.4.27
PostCSS Loader 6.2.1
Webpack 5.88.2

Also reproduced in Tailwind Play (see below)

What version of Node.js are you using?

16.13.0

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction URL

https://play.tailwindcss.com/tjJ1g2Vy8f

Describe your issue

Hello from your resident calc() bug finder 😅.

When using theme() inside arbitrary calc() values, keys can be mistakenly "normalized" if they contain a dash after a number (at least, that's what Tailwind IntelliSense tells me), causing the CSS rule to not be generated:

top-[theme(spacing.1-bar)]
top-[calc(theme(spacing.1-bar))]
top-[calc(1rem-theme(spacing.1-bar))]
top-[calc(theme(spacing.foo-2))]
top-[calc(theme(spacing.foo-bar))]

IntelliSense hover shows:

.top-\[calc\(theme\(spacing\.1-bar\)\)\] {
  top: calc(theme(spacing.1 - bar));
}

Versus:

.top-\[theme\(spacing\.1-bar\)\] {
  top: theme(spacing.1-bar);
}
@RobinMalfait
Copy link
Contributor

Hey, thank you for this bug report! 🙏

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

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

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

Successfully merging a pull request may close this issue.

2 participants