-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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] In Solid Start, &
is outputted as &
which breaks the styles
#16133
Comments
&
is outputted as &
which breaks the styles
I got the same problem, but with Svelte. I guess this is the same bug. I created a repro: https://github.com/arthur-fontaine/repro-tailwind-vite-amp-bug. I will try to reduce the repro even more. For now, I fixed this by registering the Tailwind config before the Svelte config. export default defineConfig({
- plugins: [svelte(), tailwindcss()],
+ plugins: [tailwindcss(), svelte()],
}) But I think this is an unattended behavior. The Tailwind Vite plugin should be able to compile correctly the CSS no matter the order of the plugins. EDIT: I just encountered a case where putting the Tailwind Vite plugin before the Svelte one make impossible to use |
Maybe related issues: |
@philipp-spiess, it is still happening, at least in my actual repo (not the repro I shared). Let me try in the repro, too, just in case. For context, this is happening in WSL2, but I'm not sure it matters. Edit: check the repro (in issue description) again. I've updated it to the latest version. Remember also that the issue also happened with the PostCSS setup. This makes Tailwind CSS v4 incompatible with Solid Start, and my upgrade is stuck :P |
Cross-posting solidjs/solid-start#1749 (comment)
|
Ah, important observation, regarding my actual project (not repro):
So, it seems like it might be a problem with JavaScript when disabled, which might hint that the problem is specific to the server-side build. The most confusing part of all this is, when I try in the repro, it doesn't work with or without JavaScript enabled :/ I might share my project (WIP branch) in case it's useful for debugging. I don't really know what's causing the difference. |
I'm currently trying to debug something similar in an Astro project using the vite plugin where .before\:content-\[\&\#x27\;\#\&\#x27\;\] {
&::before {
content: var(--tw-content);
--tw-content: '#';
content: var(--tw-content);
}
}
.before\:content-\[\'\#\'\] {
&::before {
content: var(--tw-content);
--tw-content: '#';
content: var(--tw-content);
}
} I'm not sure yet what's producing the escaped version but it's tripping up postcss/lightning CSS because the |
I might be looking at a different problem, however, because I notice if I remove all tailwindcss/packages/@tailwindcss-node/src/urls.ts Lines 45 to 47 in 7d51e38
|
I will insist once more that I observed this behavior with PostCSS too, and not exclusively with Vite :) However, I think a fix on Solid's side has been submitted (see ryansolid/dom-expressions#401) so, if that was the root of the issue, it should be fixed once merged. |
@DaniGuardiola Ah, I must have missed this! Glad that's fixed upstream though. I have a PR open that completely reworks the Vite extension and wanted to make sure it also resolves this issue but yeah it seems like this Solid issue is unrelated to Vite! @birtles Do you have a repro for your Astro issue? |
Not yet. I'm trying to work out what is triggering it so I can create a suitable repro but it's slow going debugging minimized code. So far I can see that the errant node is already there when the AST is finished being built here: tailwindcss/packages/tailwindcss/src/index.ts Line 715 in 604be56
So it doesn't appear to be a serialization issue. Also, we don't seem to be escaping it twice here:
So I'm not sure where it's creeping in yet. |
Oh, looks like the bogus string is coming from |
Yep, appears to be fixed in 4.0.8! |
Awesome! 🎉 |
What version of Tailwind CSS are you using?
tailwindcss
: v4.0.1@tailwindcss/vite
: 0.0.0-insiders.7f1d097The insiders version is the latest as of this issue's publication, needed because #16052 hasn't been released stable yet. However, as mentioned below, the issue also happens with a PostCSS setup, so it doesn't seem tied to vite.
What build tool (or framework if it abstracts the build tool) are you using?
For example: Solid Start (repo version directly)
What version of Node.js are you using?
For example: v23.6.1
What browser are you using?
N/A
What operating system are you using?
N/A
Reproduction URL
solidjs/solid-start#1748
Describe your issue
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:
This is actually outputted like this:
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.
The text was updated successfully, but these errors were encountered: