Skip to content

Commit ddeaa15

Browse files
committed
add source(…) improvements to @tailwindcss/postcss
1 parent 1e4aba9 commit ddeaa15

File tree

1 file changed

+16
-4
lines changed
  • packages/@tailwindcss-postcss/src

1 file changed

+16
-4
lines changed

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

+16-4
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,23 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
134134
}
135135

136136
if (context.scanner === null || rebuildStrategy === 'full') {
137+
let sources = (() => {
138+
// Disable auto source detection
139+
if (context.compiler.root === 'none') {
140+
return []
141+
}
142+
143+
// No root specified, use the base directory
144+
if (context.compiler.root === null) {
145+
return [{ base, pattern: '**/*' }]
146+
}
147+
148+
// Use the specified root
149+
return [context.compiler.root]
150+
})().concat(context.compiler.globs)
151+
137152
// Look for candidates used to generate the CSS
138-
context.scanner = new Scanner({
139-
detectSources: { base },
140-
sources: context.compiler.globs,
141-
})
153+
context.scanner = new Scanner({ sources })
142154
}
143155

144156
env.DEBUG && console.time('[@tailwindcss/postcss] Scan for candidates')

0 commit comments

Comments
 (0)