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

[v4] utility class is not generated when also applied to body #15501

Open
e-krebs opened this issue Dec 28, 2024 · 0 comments
Open

[v4] utility class is not generated when also applied to body #15501

e-krebs opened this issue Dec 28, 2024 · 0 comments

Comments

@e-krebs
Copy link

e-krebs commented Dec 28, 2024

What version of Tailwind CSS are you using?

v4.0.0-beta.8

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

Vite, but it is also reproducible in playground

What version of Node.js are you using?

22.12.0 (not sure about playground)

What browser are you using?

Chrome

What operating system are you using?

Windows 11

Reproduction URL

https://play.tailwindcss.com/uDAJ3VP1OF

Describe your issue

  • in the v4 css config, create a @utility that generate some class

    • in the playground link above: @utility bg-th { @apply bg-red-500; }
  • in the v4 css config, apply this @utility to the body

    • in the playground link above: @layer base { body { @apply bg-th; } }
  • in your html, use that same @utility class

    • in the playground link above: <div class="bg-th">
  • the red-500 color is correctly applied to the body

  • but the same red-500 is not applied to the div with bg-th class (in the playground link above it inherits its background color from its parent instead)

Without having a look at the codebase, I suspect this happens because when the bg-th utility is "applied" to the body it is also removed from the list of available classes, regardless of the fact that it is used at other places.
This is based on the fact that commenting the @apply bg-th line in the playground link above results in the bg-th class being correctly generated.

@e-krebs e-krebs changed the title [v4] background utility class is not generated when also applied to body [v4] utility class is not generated when also applied to body Dec 28, 2024
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

1 participant