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

[Bug?]: Tailwind CSS v4 outputs & as & which breaks the styles #1749

Open
2 tasks done
DaniGuardiola opened this issue Jan 31, 2025 · 5 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@DaniGuardiola
Copy link

DaniGuardiola commented Jan 31, 2025

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Tailwind CSS v4 (recently fixed to work with Solid Start) outputs & as & which breaks the styles.

For example, a class using a "dark theme" variant like this:

.dark\:bg-red-500 {
  &:where(.dark, .dark *) {
    background-color: var(--color-red-500);
  }
}

This is actually outputted like this:

.dark\:bg-red-500 {
  &:where(.dark, .dark *) {
    background-color: var(--color-red-500);
  }
}

Expected behavior 🤔

Outputs & directly.

Steps to reproduce 🕹

See repro: #1748

Context 🔦

It doesn't depend on the vite setup because it also happened with the alternative PostCSS-based setup. Unsure if the issue is on Solid Start's side or Tailwind CSS's side.

Related Tailwind CSS issue: tailwindlabs/tailwindcss#16133

@DaniGuardiola
Copy link
Author

DaniGuardiola commented Feb 7, 2025

Reading through some of the links here, it seems like a potential solution/workaround would be to have the tailwind vite plugin before the solid start (vinxi?) one. How can this be achieved in Solid Start?

Update: I just tried forcing the ordering to "pre" (docs), but it doesn't seem to make sense because tailwind() actually returns a series of plugins that already have this setting. Not sure what else to try.

@atilafassina
Copy link
Member

Since Release 1.1.0 - Gear 5, the template was bumped and Tailwind v4 support was added. Are we able to close this one, @DaniGuardiola / @birkskyum ?

@irisarco
Copy link

I've encountered the same bug, my case is quite simple:

<input class="placeholder:text-red-500" placeholder="I should be red" />

Placeholder won't be red and this is the generated CSS:

.placeholder\:text-red-500 {
  &amp;::placeholder {
    color: var(--color-red-500);
  }
}

This bug is still present on the new release.

@DaniGuardiola
Copy link
Author

The vite plugin works fine, this problem doesn't seem to be related to it. I think the example should be updated to the vite plugin, as it's the recommended setup nowadays for Tailwind CSS, likely faster too. Unless there's a blocking problem on Solid Start's end I don't know about. @atilafassina

This issue, on the other hand, happens independently of whether vite or postcss is used for the setup. Would love to see it resolved! I tried to debug but I usually make use of the vite-inspect plugin for these things, however it fails to load with an error when trying to plug it into vinxi, so I'm not sure how I can look into the build pipeline.

@mdynnl
Copy link

mdynnl commented Feb 13, 2025

I've posted my findings here in discord thread but haven't had the time to actually fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants