Skip to content

Commit 619c5ec

Browse files
committed
ensure globs are passed to the watcher
Vite exposes an `addWatchFile` function that passes the passed in contents directly to `chokidar`. Because of this, passing in globs just work as well.
1 parent 8176a0c commit 619c5ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/@tailwindcss-vite/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,24 @@ export default function tailwindcss(): Plugin[] {
8989
},
9090
})
9191

92-
let result = scanDir({ base: basePath, contentPaths: globs })
92+
let result = scanDir({ base: basePath, contentPaths: globs, outputGlobs: true })
9393

9494
for (let candidate of result.candidates) {
9595
candidates.add(candidate)
9696
}
9797

98+
// Watch individual files
9899
for (let file of result.files) {
99100
addWatchFile(file)
100101
}
101102

103+
// Watch globs
104+
for (let glob of result.globs) {
105+
if (glob.glob[0] === '!') continue
106+
107+
addWatchFile(`${glob.base}/${glob.glob}`)
108+
}
109+
102110
return build(Array.from(candidates))
103111
}
104112

0 commit comments

Comments
 (0)