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

Incorrect parsing of theme functions within calc operations without spaces #11027

Closed
thibaudcolas opened this issue Apr 18, 2023 · 1 comment
Closed

Comments

@thibaudcolas
Copy link

thibaudcolas commented Apr 18, 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 or Webpack

What version of Node.js are you using?

N/A

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://play.tailwindcss.com/sQrIVhIaM7?file=css

Describe your issue

Usage of the theme function isn’t getting replaced by the corresponding value when the function is in a calc expression without spaces. For example:

.test {
  /* Input: */
  inset: calc(-1 * (2*theme("spacing.4")));
  /* Expected: */
  inset: calc(-1 * (2*1rem));
  /* Actual: */
  inset: calc(-1 * (2*theme("spacing.4")));
}

I believe this might be the same issue as TrySound/postcss-value-parser#86, but thought I’d report it here as I’m not 100% sure and it definitely affects Tailwind.

This happened for us because we use Sass alongside Tailwind, via Webpack. sass-loader apparently outputs Sass differently in Webpack production and development mode (webpack-contrib/sass-loader#1129), with spaces removed in production.

@thecrypticace
Copy link
Contributor

Hey! I've merged the fix for this in #11157 and it'll be available in the next tagged release. And good find on the postcss-value-parser issue! We ended up inlining it into Tailwind itself and then fixing the parser to resolve this problem. Appreciate it! ✨

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