diff --git a/CHANGELOG.md b/CHANGELOG.md
index e738d386ed1d..63af8036868d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Removed `--container-prose` in favor of a deprecated `--max-width-prose` theme variable so that `*-prose` is only available for max-width utilities and only for backward compatibility ([#15439](https://github.com/tailwindlabs/tailwindcss/pull/15439))
+- Use Vite post-processor APIs for processing Svelte `
`,
'src/other.css': css`
.local {
@apply text-red-500;
- animation: 2s ease-in-out 0s infinite localKeyframes;
+ animation: 2s ease-in-out infinite localKeyframes;
}
:global(.global) {
@apply text-green-500;
- animation: 2s ease-in-out 0s infinite globalKeyframes;
+ animation: 2s ease-in-out infinite globalKeyframes;
}
@keyframes -global-globalKeyframes {
@@ -93,18 +93,21 @@ test(
},
},
async ({ exec, fs, expect }) => {
- await exec('pnpm vite build')
+ let output = await exec('pnpm vite build')
let files = await fs.glob('dist/**/*.css')
expect(files).toHaveLength(1)
await fs.expectFileToContain(files[0][0], [
candidate`underline`,
- '.global{color:var(--color-green-500);animation:2s ease-in-out 0s infinite globalKeyframes}',
- /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out 0s infinite svelte-.*-localKeyframes\}/,
+ '.global{color:var(--color-green-500);animation:2s ease-in-out infinite globalKeyframes}',
+ /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out infinite svelte-.*-localKeyframes\}/,
/@keyframes globalKeyframes\{/,
/@keyframes svelte-.*-localKeyframes\{/,
])
+
+ // Should not print any warnings
+ expect(output).not.toContain('vite-plugin-svelte')
},
)
@@ -164,20 +167,20 @@ test(
Hello {name}!
`,
'src/index.css': css` @import 'tailwindcss'; `,
'src/other.css': css`
.local {
@apply text-red-500;
- animation: 2s ease-in-out 0s infinite localKeyframes;
+ animation: 2s ease-in-out infinite localKeyframes;
}
:global(.global) {
@apply text-green-500;
- animation: 2s ease-in-out 0s infinite globalKeyframes;
+ animation: 2s ease-in-out infinite globalKeyframes;
}
@keyframes -global-globalKeyframes {
@@ -210,10 +213,10 @@ test(
let [, css] = files[0]
expect(css).toContain(candidate`underline`)
expect(css).toContain(
- '.global{color:var(--color-green-500);animation:2s ease-in-out 0s infinite globalKeyframes}',
+ '.global{color:var(--color-green-500);animation:2s ease-in-out infinite globalKeyframes}',
)
expect(css).toMatch(
- /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out 0s infinite svelte-.*-localKeyframes\}/,
+ /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out infinite svelte-.*-localKeyframes\}/,
)
expect(css).toMatch(/@keyframes globalKeyframes\{/)
expect(css).toMatch(/@keyframes svelte-.*-localKeyframes\{/)
@@ -235,10 +238,10 @@ test(
let [, css] = files[0]
expect(css).toContain(candidate`font-bold`)
expect(css).toContain(
- '.global{color:var(--color-green-500);animation:2s ease-in-out 0s infinite globalKeyframes}',
+ '.global{color:var(--color-green-500);animation:2s ease-in-out infinite globalKeyframes}',
)
expect(css).toMatch(
- /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out 0s infinite svelte-.*-localKeyframes\}/,
+ /\.local.svelte-.*\{color:var\(--color-red-500\);animation:2s ease-in-out infinite svelte-.*-localKeyframes\}/,
)
expect(css).toMatch(/@keyframes globalKeyframes\{/)
expect(css).toMatch(/@keyframes svelte-.*-localKeyframes\{/)
diff --git a/packages/@tailwindcss-vite/src/index.ts b/packages/@tailwindcss-vite/src/index.ts
index b3c9ace1e0f5..f98cf01cfb92 100644
--- a/packages/@tailwindcss-vite/src/index.ts
+++ b/packages/@tailwindcss-vite/src/index.ts
@@ -79,11 +79,6 @@ export default function tailwindcss(): Plugin[] {
for (let [id, root] of roots.entries()) {
let module = server.moduleGraph.getModuleById(id)
if (!module) {
- // The module for this root might not exist yet
- if (root.builtBeforeTransform) {
- continue
- }
-
// Note: Removing this during SSR is not safe and will produce
// inconsistent results based on the timing of the removal and
// the order / timing of transforms.
@@ -184,7 +179,6 @@ export default function tailwindcss(): Plugin[] {
}
return [
- svelteProcessor(roots),
{
// Step 1: Scan source files for candidates
name: '@tailwindcss/vite:scan',
@@ -225,19 +219,6 @@ export default function tailwindcss(): Plugin[] {
let root = roots.get(id)
- // If the root was built outside of the transform hook (e.g. in the
- // Svelte preprocessor), we still want to mark all dependencies of the
- // root as watched files.
- if (root.builtBeforeTransform) {
- root.builtBeforeTransform.forEach((file) => this.addWatchFile(file))
- root.builtBeforeTransform = undefined
- }
-
- // We only process Svelte `