@@ -26,12 +26,6 @@ export default function tailwindcss(): Plugin[] {
26
26
27
27
let roots : Map < string , Root > = new Map ( )
28
28
29
- // Since new roots can be added at any time, we need to keep track of every
30
- // potential candidate file that was referenced before a root was created. To
31
- // save memory, this will store the path so we can read the latest version
32
- // from the disk and don't need to keep it in memory.
33
- let candidatePaths = new Set < string > ( )
34
-
35
29
// The Vite extension has two types of sources for candidates:
36
30
//
37
31
// 1. The module graph: These are all modules that vite transforms and we want
@@ -182,13 +176,6 @@ export default function tailwindcss(): Plugin[] {
182
176
this . candidates . add ( candidate )
183
177
}
184
178
185
- // Seed the candidate cache with candidates from all known candidate paths
186
- for ( let candidate of this . scanner . scanFiles (
187
- [ ...candidatePaths . values ( ) ] . map ( ( path ) => ( { file : path , extension : getExtension ( path ) } ) ) ,
188
- ) ) {
189
- this . candidates . add ( candidate )
190
- }
191
-
192
179
// Watch individual files found via custom `@source` paths
193
180
for ( let file of this . scanner . files ) {
194
181
addWatchFile ( file )
@@ -354,6 +341,7 @@ export default function tailwindcss(): Plugin[] {
354
341
async transform ( src , id , options ) {
355
342
if ( ! isPotentialCssRootFile ( id ) ) return
356
343
344
+ // TODO: Use DefaultMap
357
345
let root = roots . get ( id )
358
346
if ( ! root ) {
359
347
root = new Root ( id )
@@ -392,6 +380,7 @@ export default function tailwindcss(): Plugin[] {
392
380
async transform ( src , id ) {
393
381
if ( ! isPotentialCssRootFile ( id ) ) return
394
382
383
+ // TODO: Use DefaultMap
395
384
let root = roots . get ( id )
396
385
if ( ! root ) {
397
386
root = new Root ( id )
@@ -459,7 +448,10 @@ function isCssRootFile(content: string) {
459
448
content . includes ( '@tailwind' ) ||
460
449
content . includes ( '@config' ) ||
461
450
content . includes ( '@plugin' ) ||
462
- content . includes ( '@apply' )
451
+ content . includes ( '@apply' ) ||
452
+ content . includes ( '@theme' ) ||
453
+ content . includes ( '@variant' ) ||
454
+ content . includes ( '@utility' )
463
455
)
464
456
}
465
457
0 commit comments