From 8bab0d2f2da6d8829af570b9bdc0359f954008ab Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 21 Oct 2024 16:15:28 -0400 Subject: [PATCH 1/2] Ensure changes to the input CSS file result in a full rebuild --- integrations/cli/index.test.ts | 17 +++++++++++++++++ .../src/commands/build/index.ts | 13 +++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/integrations/cli/index.test.ts b/integrations/cli/index.test.ts index 22ae766df273..f392f754486a 100644 --- a/integrations/cli/index.test.ts +++ b/integrations/cli/index.test.ts @@ -210,6 +210,23 @@ describe.each([ } `, ]) + + await fs.write( + 'project-a/src/index.css', + css` + @import 'tailwindcss/utilities'; + @theme { + --color-*: initial; + } + `, + ) + + await fs.expectFileToContain('project-a/dist/out.css', [ + css` + :root { + } + `, + ]) }, ) diff --git a/packages/@tailwindcss-cli/src/commands/build/index.ts b/packages/@tailwindcss-cli/src/commands/build/index.ts index 02a39b266826..dc8ba2a90178 100644 --- a/packages/@tailwindcss-cli/src/commands/build/index.ts +++ b/packages/@tailwindcss-cli/src/commands/build/index.ts @@ -122,11 +122,12 @@ export async function handle(args: Result>) { env.DEBUG && console.timeEnd('[@tailwindcss/cli] Write output') } - let inputBasePath = - args['--input'] && args['--input'] !== '-' - ? path.dirname(path.resolve(args['--input'])) - : process.cwd() - let fullRebuildPaths: string[] = [] + let inputFilePath = + args['--input'] && args['--input'] !== '-' ? path.resolve(args['--input']) : null + + let inputBasePath = inputFilePath ? path.dirname(inputFilePath) : process.cwd() + + let fullRebuildPaths: string[] = inputFilePath ? [inputFilePath] : [] async function createCompiler(css: string) { env.DEBUG && console.time('[@tailwindcss/cli] Setup compiler') @@ -201,7 +202,7 @@ export async function handle(args: Result>) { @import 'tailwindcss'; ` clearRequireCache(resolvedFullRebuildPaths) - fullRebuildPaths = [] + fullRebuildPaths = inputFilePath ? [inputFilePath] : [] // Create a new compiler, given the new `input` compiler = await createCompiler(input) From 2dff1a0f710a508429afb6533d0493ae93e21322 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 21 Oct 2024 16:17:29 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f1317f2eb3..79b8e977cdc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Allow spaces spaces around operators in attribute selector variants ([#14703](https://github.com/tailwindlabs/tailwindcss/pull/14703)) - Ensure color opacity modifiers work with OKLCH colors ([#14741](https://github.com/tailwindlabs/tailwindcss/pull/14741)) +- Ensure changes to the input CSS file result in a full rebuild ([#14744](https://github.com/tailwindlabs/tailwindcss/pull/14744)) - _Upgrade (experimental)_: Migrate `flex-grow` to `grow` and `flex-shrink` to `shrink` ([#14721](https://github.com/tailwindlabs/tailwindcss/pull/14721)) - _Upgrade (experimental)_: Minify arbitrary values when printing candidates ([#14720](https://github.com/tailwindlabs/tailwindcss/pull/14720)) - _Upgrade (experimental)_: Ensure legacy theme values ending in `1` (like `theme(spacing.1)`) are correctly migrated to custom properties ([#14724](https://github.com/tailwindlabs/tailwindcss/pull/14724))