Skip to content

Commit 184bf2c

Browse files
Revert changes
1 parent 79f576a commit 184bf2c

File tree

5 files changed

+66
-73
lines changed

5 files changed

+66
-73
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- _Experimental_: Add `user-valid` and `user-invalid` variants ([#12370](https://github.com/tailwindlabs/tailwindcss/pull/12370))
13-
- Vite: Add a new `scanner` option to disable module-graph based scanning ([#16425](https://github.com/tailwindlabs/tailwindcss/pull/16425))
1413

1514
### Fixed
1615

@@ -21,9 +20,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2120
- Ensure `--default-outline-width` can be used to change the `outline-width` value of the `outline` utility
2221
- Ensure drop shadow utilities don't inherit unexpectedly ([#16471](https://github.com/tailwindlabs/tailwindcss/pull/16471))
2322
- Export backwards compatible config and plugin types from `tailwindcss/plugin` ([#16505](https://github.com/tailwindlabs/tailwindcss/pull/16505))
23+
- Ensure JavaScript plugins that emit nested rules referencing to the utility name work as expected ([#16539](https://github.com/tailwindlabs/tailwindcss/pull/16539))
24+
- Statically link Visual Studio redistributables on Windows builds ([#16602](https://github.com/tailwindlabs/tailwindcss/pull/16602))
25+
- Ensure that Next.js splat routes are automatically scanned for classes ([#16457](https://github.com/tailwindlabs/tailwindcss/pull/16457))
26+
- Pin exact versions of `tailwindcss` and `@tailwindcss/*` ([#16623](https://github.com/tailwindlabs/tailwindcss/pull/16623))
2427
- Upgrade: Report errors when updating dependencies ([#16504](https://github.com/tailwindlabs/tailwindcss/pull/16504))
2528
- Upgrade: Ensure a `darkMode` JS config setting with block syntax converts to use `@slot` ([#16507](https://github.com/tailwindlabs/tailwindcss/pull/16507))
26-
- Vite: Ensure that Astro builds with client-only components are always scanned ([#16425](https://github.com/tailwindlabs/tailwindcss/pull/16425))
29+
- Upgrade: Ensure to upgrade to the latest version of `tailwindcss` and `@tailwindcss/postcss` ([#16620](https://github.com/tailwindlabs/tailwindcss/pull/16620))
2730

2831
## [4.0.6] - 2025-02-10
2932

integrations/vite/index.test.ts

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ import {
1414
yaml,
1515
} from '../utils'
1616

17-
describe.each([
18-
['postcss', 'module-graph'],
19-
['postcss', 'file-system'],
20-
['lightningcss', 'module-graph'],
21-
['lightningcss', 'file-system'],
22-
])('using %s via %s', (transformer, scanner) => {
17+
describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
2318
test(
2419
`production build`,
2520
{
@@ -50,7 +45,7 @@ describe.each([
5045
export default defineConfig({
5146
css: ${transformer === 'postcss' ? '{}' : "{ transformer: 'lightningcss' }"},
5247
build: { cssMinify: false },
53-
plugins: [tailwindcss({ scanner: '${scanner}' })],
48+
plugins: [tailwindcss()],
5449
})
5550
`,
5651
'project-a/index.html': html`
@@ -62,7 +57,9 @@ describe.each([
6257
</body>
6358
`,
6459
'project-a/tailwind.config.js': js`
65-
export default { content: ['../project-b/src/**/*.js'] }
60+
export default {
61+
content: ['../project-b/src/**/*.js'],
62+
}
6663
`,
6764
'project-a/src/index.css': css`
6865
@import 'tailwindcss/theme' theme(reference);
@@ -125,7 +122,7 @@ describe.each([
125122
export default defineConfig({
126123
css: ${transformer === 'postcss' ? '{}' : "{ transformer: 'lightningcss' }"},
127124
build: { cssMinify: false },
128-
plugins: [tailwindcss({ scanner: '${scanner}' })],
125+
plugins: [tailwindcss()],
129126
})
130127
`,
131128
'project-a/index.html': html`
@@ -145,7 +142,9 @@ describe.each([
145142
</body>
146143
`,
147144
'project-a/tailwind.config.js': js`
148-
export default { content: ['../project-b/src/**/*.js'] }
145+
export default {
146+
content: ['../project-b/src/**/*.js'],
147+
}
149148
`,
150149
'project-a/src/index.css': css`
151150
@import 'tailwindcss/theme' theme(reference);
@@ -163,7 +162,9 @@ describe.each([
163162
},
164163
},
165164
async ({ root, spawn, fs, expect }) => {
166-
let process = await spawn('pnpm vite dev', { cwd: path.join(root, 'project-a') })
165+
let process = await spawn('pnpm vite dev', {
166+
cwd: path.join(root, 'project-a'),
167+
})
167168
await process.onStdout((m) => m.includes('ready in'))
168169

169170
let url = ''
@@ -173,19 +174,17 @@ describe.each([
173174
return Boolean(url)
174175
})
175176

176-
// Candidates are resolved lazily in module-graph mode, so the first visit of index.html will
177-
// only have candidates from this file.
177+
// Candidates are resolved lazily, so the first visit of index.html
178+
// will only have candidates from this file.
178179
await retryAssertion(async () => {
179180
let styles = await fetchStyles(url, '/index.html')
180181
expect(styles).toContain(candidate`underline`)
181182
expect(styles).toContain(candidate`flex`)
182-
183-
if (scanner === 'module-graph') {
184-
expect(styles).not.toContain(candidate`font-bold`)
185-
}
183+
expect(styles).not.toContain(candidate`font-bold`)
186184
})
187185

188-
// Going to about.html will extend the candidate list to include candidates from about.html.
186+
// Going to about.html will extend the candidate list to include
187+
// candidates from about.html.
189188
await retryAssertion(async () => {
190189
let styles = await fetchStyles(url, '/about.html')
191190
expect(styles).toContain(candidate`underline`)
@@ -233,8 +232,8 @@ describe.each([
233232
})
234233

235234
await retryAssertion(async () => {
236-
// After updates to the CSS file, all previous candidates should still be in the generated
237-
// stylesheet.
235+
// After updates to the CSS file, all previous candidates should still be in
236+
// the generated CSS
238237
await fs.write(
239238
'project-a/src/index.css',
240239
css`
@@ -284,7 +283,10 @@ describe.each([
284283
import tailwindcss from '@tailwindcss/vite'
285284
import { defineConfig } from 'vite'
286285
287-
export default defineConfig({ build: { cssMinify: false }, plugins: [tailwindcss()] })
286+
export default defineConfig({
287+
build: { cssMinify: false },
288+
plugins: [tailwindcss()],
289+
})
288290
`,
289291
'project-a/index.html': html`
290292
<head>
@@ -295,7 +297,9 @@ describe.each([
295297
</body>
296298
`,
297299
'project-a/tailwind.config.js': js`
298-
export default { content: ['../project-b/src/**/*.js'] }
300+
export default {
301+
content: ['../project-b/src/**/*.js'],
302+
}
299303
`,
300304
'project-a/src/index.css': css`
301305
@import 'tailwindcss/theme' theme(reference);
@@ -320,7 +324,9 @@ describe.each([
320324
},
321325
},
322326
async ({ root, spawn, fs, expect }) => {
323-
let process = await spawn('pnpm vite build --watch', { cwd: path.join(root, 'project-a') })
327+
let process = await spawn('pnpm vite build --watch', {
328+
cwd: path.join(root, 'project-a'),
329+
})
324330
await process.onStdout((m) => m.includes('built in'))
325331

326332
let filename = ''
@@ -459,7 +465,7 @@ describe.each([
459465
export default defineConfig({
460466
css: ${transformer === 'postcss' ? '{}' : "{ transformer: 'lightningcss' }"},
461467
build: { cssMinify: false },
462-
plugins: [tailwindcss({ scanner: '${scanner}' })],
468+
plugins: [tailwindcss()],
463469
})
464470
`,
465471
'project-a/index.html': html`
@@ -545,7 +551,7 @@ describe.each([
545551
export default defineConfig({
546552
css: ${transformer === 'postcss' ? '{}' : "{ transformer: 'lightningcss' }"},
547553
build: { cssMinify: false },
548-
plugins: [tailwindcss({ scanner: '${scanner}' })],
554+
plugins: [tailwindcss()],
549555
})
550556
`,
551557
'project-a/index.html': html`
@@ -647,7 +653,7 @@ describe.each([
647653
export default defineConfig({
648654
css: ${transformer === 'postcss' ? '{}' : "{ transformer: 'lightningcss' }"},
649655
build: { cssMinify: false },
650-
plugins: [tailwindcss({ scanner: '${scanner}' })],
656+
plugins: [tailwindcss()],
651657
})
652658
`,
653659
'project-a/index.html': html`
@@ -696,15 +702,23 @@ test(
696702
'package.json': json`
697703
{
698704
"type": "module",
699-
"dependencies": { "@tailwindcss/vite": "workspace:^", "tailwindcss": "workspace:^" },
700-
"devDependencies": { "vite": "^6" }
705+
"dependencies": {
706+
"@tailwindcss/vite": "workspace:^",
707+
"tailwindcss": "workspace:^"
708+
},
709+
"devDependencies": {
710+
"vite": "^6"
711+
}
701712
}
702713
`,
703714
'vite.config.ts': ts`
704715
import tailwindcss from '@tailwindcss/vite'
705716
import { defineConfig } from 'vite'
706717
707-
export default defineConfig({ build: { cssMinify: false }, plugins: [tailwindcss()] })
718+
export default defineConfig({
719+
build: { cssMinify: false },
720+
plugins: [tailwindcss()],
721+
})
708722
`,
709723
'index.html': html`
710724
<head>
@@ -770,15 +784,23 @@ test(
770784
'package.json': json`
771785
{
772786
"type": "module",
773-
"dependencies": { "@tailwindcss/vite": "workspace:^", "tailwindcss": "workspace:^" },
774-
"devDependencies": { "vite": "^6" }
787+
"dependencies": {
788+
"@tailwindcss/vite": "workspace:^",
789+
"tailwindcss": "workspace:^"
790+
},
791+
"devDependencies": {
792+
"vite": "^6"
793+
}
775794
}
776795
`,
777796
'vite.config.ts': ts`
778797
import tailwindcss from '@tailwindcss/vite'
779798
import { defineConfig } from 'vite'
780799
781-
export default defineConfig({ build: { cssMinify: false }, plugins: [tailwindcss()] })
800+
export default defineConfig({
801+
build: { cssMinify: false },
802+
plugins: [tailwindcss()],
803+
})
782804
`,
783805
'index.html': html`
784806
<head>
@@ -838,7 +860,10 @@ test(
838860
import tailwindcss from '@tailwindcss/vite'
839861
import { defineConfig } from 'vite'
840862
841-
export default defineConfig({ build: { cssMinify: false }, plugins: [tailwindcss()] })
863+
export default defineConfig({
864+
build: { cssMinify: false },
865+
plugins: [tailwindcss()],
866+
})
842867
`,
843868
'index.html': html`
844869
<head>

integrations/vite/react-router.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ test(
156156
import tailwindcss from '@tailwindcss/vite'
157157
158158
export default defineConfig({
159-
plugins: [tailwindcss({ scanner: 'file-system' }), reactRouter()],
159+
plugins: [tailwindcss(), reactRouter()],
160160
})
161161
`,
162162
'.gitignore': txt`

integrations/vite/ssr.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test(
5151
cssMinify: false,
5252
ssrEmitAssets: true,
5353
},
54-
plugins: [tailwindcss({ scanner: 'file-system' })],
54+
plugins: [tailwindcss()],
5555
})
5656
`,
5757
...WORKSPACE,
@@ -98,7 +98,7 @@ test(
9898
cssMinify: false,
9999
ssrEmitAssets: true,
100100
},
101-
plugins: [tailwindcss({ scanner: 'file-system' })],
101+
plugins: [tailwindcss()],
102102
})
103103
`,
104104
...WORKSPACE,

packages/@tailwindcss-vite/README.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,10 @@
2121

2222
---
2323

24-
# `@tailwindcss/vite`
25-
2624
## Documentation
2725

2826
For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
2927

30-
---
31-
32-
## Advanced topics
33-
34-
### API reference
35-
36-
The Vite plugin can be configured by passing an object to the `tailwindcss()`. Here is a full list of available options:
37-
38-
| Property | Values |
39-
| --------------------------------------------- | ------------------------------------------------------ |
40-
| [`scanner`](#disabling-module-graph-scanning) | `automatic` _(default)_, `module-graph`, `file-system` |
41-
42-
### Disabling module-graph scanning
43-
44-
Our Vite plugin is designed to take the Vite module graph into account when scanning for utilities used in your project. This will work well in most cases since the module graph contains all markup that will be in your final build.
45-
46-
However, sometimes your Vite setup is split across different build steps (e.g. when using SSR builds). If that is the case, you might find that the client build might contain more utilities since it traverses all components while the server build doesn't.
47-
48-
When the `scanner` is set to `automatic`, we will automatically use the `file-system` scanner for Astro builds.
49-
50-
To ensure that both builds read all components from your project in other cases, set the `scanner` option to `file-system`:
51-
52-
```js
53-
import { defineConfig } from 'vite'
54-
import tailwindcss from '@tailwindcss/vite'
55-
56-
export default defineConfig({
57-
plugins: [tailwindcss({ scanner: 'file-system' })],
58-
})
59-
```
60-
61-
---
62-
6328
## Community
6429

6530
For help, discussion about best practices, or any other conversation that would benefit from being searchable:

0 commit comments

Comments
 (0)