From 535823c96da140b71aea34982e37547d0380377b Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 25 Oct 2024 18:11:16 +0200 Subject: [PATCH] =?UTF-8?q?update=20`@tailwindcss/postcss`=20with=20new=20?= =?UTF-8?q?`source(=E2=80=A6)`=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@tailwindcss-postcss/src/index.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 4dfde5103..aeb428176 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -134,10 +134,23 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { } if (context.scanner === null || rebuildStrategy === 'full') { + let sources = (() => { + // Disable auto source detection + if (context.compiler.root === 'none') { + return [] + } + + // No root specified, use the base directory + if (context.compiler.root === null) { + return [{ base, pattern: '**/*' }] + } + + // Use the specified root + return [context.compiler.root] + })().concat(context.compiler.globs) + // Look for candidates used to generate the CSS - context.scanner = new Scanner({ - sources: [{ base, pattern: '**/*' }].concat(context.compiler.globs), - }) + context.scanner = new Scanner({ sources }) } env.DEBUG && console.time('[@tailwindcss/postcss] Scan for candidates')