Skip to content

Commit

Permalink
map globs to Vec<GlobEntry>
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Aug 2, 2024
1 parent ff28e08 commit 54087b9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/@tailwindcss-vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,27 @@ export default function tailwindcss(): Plugin[] {
}

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

let { build, globs } = compile(css, {
loadPlugin: (pluginPath) => {
if (pluginPath[0] === '.') {
return require(path.resolve(basePath, pluginPath))
return require(path.resolve(inputBasePath, pluginPath))
}

return require(pluginPath)
},
})

let result = scanDir({ base: basePath, contentPaths: globs })
let result = scanDir({
// TODO: This might not be necessary if we enable/disabled auto content
// detection
base: inputBasePath, // Root directory, mainly used for auto content detection
contentPaths: globs.map((glob) => ({
base: inputBasePath, // Globs are relative to the input.css file
glob,
})),
})

for (let candidate of result.candidates) {
candidates.add(candidate)
Expand Down

0 comments on commit 54087b9

Please sign in to comment.