Skip to content

Commit 60849b4

Browse files
committed
map globs to Vec<GlobEntry>
1 parent 17c7422 commit 60849b4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,27 @@ export default function tailwindcss(): Plugin[] {
7575
}
7676

7777
function generateCss(css: string, inputPath: string, addWatchFile: (file: string) => void) {
78-
let basePath = path.dirname(path.resolve(inputPath))
78+
let inputBasePath = path.dirname(path.resolve(inputPath))
7979

8080
let { build, globs } = compile(css, {
8181
loadPlugin: (pluginPath) => {
8282
if (pluginPath[0] === '.') {
83-
return require(path.resolve(basePath, pluginPath))
83+
return require(path.resolve(inputBasePath, pluginPath))
8484
}
8585

8686
return require(pluginPath)
8787
},
8888
})
8989

90-
let result = scanDir({ base: basePath, contentPaths: globs })
90+
let result = scanDir({
91+
// TODO: This might not be necessary if we enable/disabled auto content
92+
// detection
93+
base: inputBasePath, // Root directory, mainly used for auto content detection
94+
contentPaths: globs.map((glob) => ({
95+
base: inputBasePath, // Globs are relative to the input.css file
96+
glob,
97+
})),
98+
})
9199

92100
for (let candidate of result.candidates) {
93101
candidates.add(candidate)

0 commit comments

Comments
 (0)