Skip to content

Commit 7b45b77

Browse files
committed
forward correct source(…) to the oxide scanner
1 parent a62b010 commit 7b45b77

File tree

1 file changed

+21
-14
lines changed
  • packages/@tailwindcss-cli/src/commands/build

1 file changed

+21
-14
lines changed

packages/@tailwindcss-cli/src/commands/build/index.ts

+21-14
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,29 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
137137
fullRebuildPaths.push(path)
138138
},
139139
})
140+
141+
let detectSources = (() => {
142+
// Disable auto source detection
143+
if (compiler.root === 'none') {
144+
return undefined
145+
}
146+
147+
// No root specified, use the base directory
148+
if (compiler.root === null) {
149+
return { base }
150+
}
151+
152+
// Use the specified root
153+
return { base: path.resolve(compiler.root.base, compiler.root.pattern) }
154+
})()
155+
156+
let scanner = new Scanner({ detectSources, sources: compiler.globs })
140157
env.DEBUG && console.timeEnd('[@tailwindcss/cli] Setup compiler')
141-
return compiler
158+
159+
return [compiler, scanner] as const
142160
}
143161

144-
// Compile the input
145-
let compiler = await createCompiler(input)
146-
let scanner = new Scanner({
147-
detectSources: { base },
148-
sources: compiler.globs,
149-
})
162+
let [compiler, scanner] = await createCompiler(input)
150163

151164
// Watch for changes
152165
if (args['--watch']) {
@@ -205,13 +218,7 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
205218
fullRebuildPaths = inputFilePath ? [inputFilePath] : []
206219

207220
// Create a new compiler, given the new `input`
208-
compiler = await createCompiler(input)
209-
210-
// Re-scan the directory to get the new `candidates`
211-
scanner = new Scanner({
212-
detectSources: { base },
213-
sources: compiler.globs,
214-
})
221+
;[compiler, scanner] = await createCompiler(input)
215222

216223
// Scan the directory for candidates
217224
env.DEBUG && console.time('[@tailwindcss/cli] Scan for candidates')

0 commit comments

Comments
 (0)