From 640d208f016cb3f91560e06c0baca5244fc030c5 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 27 Mar 2024 00:58:54 +0100 Subject: [PATCH 1/3] ensure we check both `-o` and `--output` --- packages/@tailwindcss-cli/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@tailwindcss-cli/src/index.ts b/packages/@tailwindcss-cli/src/index.ts index 3622a858c438..9e1527641ff4 100644 --- a/packages/@tailwindcss-cli/src/index.ts +++ b/packages/@tailwindcss-cli/src/index.ts @@ -33,7 +33,11 @@ if (command) { // // - `tailwindcss -o output.css` // should run the build command, not show the help message // - `tailwindcss > output.css` // should run the build command, not show the help message -if ((process.stdout.isTTY && !process.argv.slice(2).includes('-o')) || shared['--help']) { +if ( + (process.stdout.isTTY && + !process.argv.slice(2).some((flag) => flag === '-o' || flag === '--output')) || + shared['--help'] +) { help({ usage: ['tailwindcss [--input input.css] [--output output.css] [--watch] [options…]'], options: { ...build.options(), ...sharedOptions }, From 9e006c971f2aa25747c00bc58fc3a431341d5c24 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 27 Mar 2024 01:01:34 +0100 Subject: [PATCH 2/3] build all flags upfront Right now the only command is the build command and we have to parse the flags either way (either for the help or for the build itself). This simplifies the code a bit, because `-o` and `--output` will be normalised. --- packages/@tailwindcss-cli/src/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/@tailwindcss-cli/src/index.ts b/packages/@tailwindcss-cli/src/index.ts index 9e1527641ff4..511781759079 100644 --- a/packages/@tailwindcss-cli/src/index.ts +++ b/packages/@tailwindcss-cli/src/index.ts @@ -9,8 +9,11 @@ const sharedOptions = { '--help': { type: 'boolean', description: 'Display usage information', alias: '-h' }, } satisfies Arg -const shared = args(sharedOptions) -const command = shared._[0] +const flags = args({ + ...build.options(), + ...sharedOptions, +}) +const command = flags._[0] // Right now we don't support any sub-commands. Let's show the help message // instead. @@ -33,11 +36,7 @@ if (command) { // // - `tailwindcss -o output.css` // should run the build command, not show the help message // - `tailwindcss > output.css` // should run the build command, not show the help message -if ( - (process.stdout.isTTY && - !process.argv.slice(2).some((flag) => flag === '-o' || flag === '--output')) || - shared['--help'] -) { +if ((process.stdout.isTTY && !flags['--output']) || flags['--help']) { help({ usage: ['tailwindcss [--input input.css] [--output output.css] [--watch] [options…]'], options: { ...build.options(), ...sharedOptions }, @@ -46,4 +45,4 @@ if ( } // Handle the build command -build.handle(args(build.options())) +build.handle(flags) From 457006cc45cda6607744c63f4dcfad1bf4e1fa42 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 27 Mar 2024 01:04:58 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 015e877b8e3b..6ec1c71fe80d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove percentage values for `translate-z` utilities ([#13321](https://github.com/tailwindlabs/tailwindcss/pull/13321), [#13327](https://github.com/tailwindlabs/tailwindcss/pull/13327)) - `@tailwind/vite` now generates unique CSS bundle hashes when the Tailwind-generated CSS changes ([#13218](https://github.com/tailwindlabs/tailwindcss/pull/13218)) - Inherit letter spacing in form controls ([#13328](https://github.com/tailwindlabs/tailwindcss/pull/13328)) +- Ensure `build` command is executed when using `--output` instead of `-o` ([#13369](https://github.com/tailwindlabs/tailwindcss/pull/13369)) ## [4.0.0-alpha.10] - 2024-03-19