Skip to content

Add --silent option to suppress output in @tailwindcss/cli#20100

Merged
RobinMalfait merged 6 commits into
tailwindlabs:mainfrom
jordan-brough:quiet-option
May 22, 2026
Merged

Add --silent option to suppress output in @tailwindcss/cli#20100
RobinMalfait merged 6 commits into
tailwindlabs:mainfrom
jordan-brough:quiet-option

Conversation

@jordan-brough

@jordan-brough jordan-brough commented May 22, 2026

Copy link
Copy Markdown
Contributor

Edited by: @RobinMalfait

This PR adds a new --silent option to the @tailwindcss/cli to suppress output (except for errors).

Test plan

  • Existing tests pass
  • A new integration test for the --silent option was added

Original:

Summary

Small change to add a --quiet option.

@adamwathan previously said this type of thing sounded like a good idea:

[I] have made a note about the --silent option idea which I think definitely has value 👍🏻

This is helpful to keep logs high signal in some scenarios. For example, when I want AI to sift through my foreman logs, where "Done in X" becomes the dominant log message over time when running tailwind alongside other things.

Test plan

I've added an integration test.

@jordan-brough jordan-brough requested a review from a team as a code owner May 22, 2026 10:49
@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds a --silent CLI flag to the Tailwind build command. The option is declared in options(), the initial header/blank line and all "Done in …" timing messages are now printed only when --silent is not set (watch early-return, watch rebuild completion, initial non-watch completion), and a Vitest verifies that loud runs include the banner/timing while silent runs omit them and both produce the expected CSS.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly summarizes the main change: adding a --silent option to suppress output in the CLI tool.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the --silent option and including a test plan that matches the implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
integrations/cli/index.test.ts (1)

2240-2242: ⚡ Quick win

Add an assertion path for the long-form --quiet flag.

Line 2240 currently exercises only -q. Since the public CLI contract includes --quiet too, add one explicit run with --quiet to lock that in.

✅ Minimal test extension
   let quietOutput = await exec('pnpm tailwindcss --input index.css --output dist/quiet.css -q')
   expect(quietOutput).not.toContain('Done in')
   expect(quietOutput).toContain('tailwindcss v')
 
+  let quietLongOutput = await exec(
+    'pnpm tailwindcss --input index.css --output dist/quiet-long.css --quiet',
+  )
+  expect(quietLongOutput).not.toContain('Done in')
+
   await fs.expectFileToContain('dist/quiet.css', [candidate`flex`])
+  await fs.expectFileToContain('dist/quiet-long.css', [candidate`flex`])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integrations/cli/index.test.ts` around lines 2240 - 2242, The test currently
only exercises the short flag `-q`; add an explicit run that uses the long-form
`--quiet` flag by calling the same helper `exec` (e.g., assign to a new variable
like `quietOutputLong`) with the command string including `--quiet` instead of
`-q`, and assert the same expectations as the existing assertions (that the
output does not contain 'Done in' and does contain 'tailwindcss v') so the CLI
contract for `--quiet` is locked in.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@integrations/cli/index.test.ts`:
- Around line 2240-2242: The test currently only exercises the short flag `-q`;
add an explicit run that uses the long-form `--quiet` flag by calling the same
helper `exec` (e.g., assign to a new variable like `quietOutputLong`) with the
command string including `--quiet` instead of `-q`, and assert the same
expectations as the existing assertions (that the output does not contain 'Done
in' and does contain 'tailwindcss v') so the CLI contract for `--quiet` is
locked in.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c1c88e82-950b-49e2-9dcc-7387a89c7452

📥 Commits

Reviewing files that changed from the base of the PR and between 8dcdb66 and 40ee5d7.

📒 Files selected for processing (2)
  • integrations/cli/index.test.ts
  • packages/@tailwindcss-cli/src/commands/build/index.ts

@greptile-apps

greptile-apps Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The change is narrow in scope — a new opt-in boolean flag that only suppresses informational stderr output — and does not touch any build logic, CSS compilation, or file I/O.

Every informational eprintln site (header, blank line, and all three "Done in" paths including watch-mode rebuilds) is consistently guarded. Error messages are intentionally left unguarded. The new integration test exercises both the guarded and unguarded paths and confirms output file content is unaffected. No existing behavior changes for users who don't pass --silent.

No files require special attention.

Reviews (3): Last reviewed commit: "update changelog" | Re-trigger Greptile

Comment thread integrations/cli/index.test.ts Outdated
@RobinMalfait RobinMalfait changed the title Add --quiet option to suppress "Done in [x]" build timing messages Add --silent option to suppress output in @tailwindcss/cli May 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
integrations/cli/index.test.ts (1)

2237-2245: ⚡ Quick win

Assert loud-mode banner explicitly to lock in default behavior.

The test currently verifies silent-mode banner suppression, but not that non-silent mode still emits the banner. Adding that assertion protects the non-silent contract.

Suggested test tweak
     let output = await exec('pnpm tailwindcss --input index.css --output dist/loud.css')
     expect(output).toContain('Done in')
+    expect(output).toContain('tailwindcss v')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integrations/cli/index.test.ts` around lines 2237 - 2245, The loud-mode test
currently only checks for 'Done in' but doesn't assert that the non-silent
banner is emitted; update the test around the exec call (the variable output
returned by exec('pnpm tailwindcss --input index.css --output dist/loud.css'))
to also assert that output contains the tailwind banner (for example assert
output contains 'tailwindcss v' or the expected banner string) so the default
non-silent behavior is locked in while keeping the existing silent-mode
assertions for silentOutput.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@integrations/cli/index.test.ts`:
- Around line 2237-2245: The loud-mode test currently only checks for 'Done in'
but doesn't assert that the non-silent banner is emitted; update the test around
the exec call (the variable output returned by exec('pnpm tailwindcss --input
index.css --output dist/loud.css')) to also assert that output contains the
tailwind banner (for example assert output contains 'tailwindcss v' or the
expected banner string) so the default non-silent behavior is locked in while
keeping the existing silent-mode assertions for silentOutput.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7cc0d504-5743-423f-a4ff-814ca27762b0

📥 Commits

Reviewing files that changed from the base of the PR and between 40ee5d7 and 5945a18.

📒 Files selected for processing (2)
  • integrations/cli/index.test.ts
  • packages/@tailwindcss-cli/src/commands/build/index.ts

@RobinMalfait RobinMalfait enabled auto-merge (squash) May 22, 2026 12:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
integrations/cli/index.test.ts (1)

2237-2244: ⚡ Quick win

Consider adding assertion for banner in loud output.

The test validates that --silent suppresses both "Done in" and "tailwindcss v", but doesn't verify that the loud output includes "tailwindcss v". While the current test is valid, adding expect(output).toContain('tailwindcss v') after line 2238 would make the test more thorough by explicitly verifying the banner appears in normal mode.

✨ Suggested enhancement
 let output = await exec('pnpm tailwindcss --input index.css --output dist/loud.css')
 expect(output).toContain('Done in')
+expect(output).toContain('tailwindcss v')

 let silentOutput = await exec(
   'pnpm tailwindcss --input index.css --output dist/silent.css --silent',
 )
 expect(silentOutput).not.toContain('Done in')
 expect(silentOutput).not.toContain('tailwindcss v')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integrations/cli/index.test.ts` around lines 2237 - 2244, The test currently
checks that loud output contains "Done in" and silent output omits both "Done
in" and "tailwindcss v", but doesn't assert that the loud output includes the
banner; update the test that calls exec (the variable named output from
exec('pnpm tailwindcss --input index.css --output dist/loud.css')) to also
assert expect(output).toContain('tailwindcss v') immediately after the existing
expect(output).toContain('Done in') so the loud mode banner is explicitly
verified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@integrations/cli/index.test.ts`:
- Around line 2237-2244: The test currently checks that loud output contains
"Done in" and silent output omits both "Done in" and "tailwindcss v", but
doesn't assert that the loud output includes the banner; update the test that
calls exec (the variable named output from exec('pnpm tailwindcss --input
index.css --output dist/loud.css')) to also assert
expect(output).toContain('tailwindcss v') immediately after the existing
expect(output).toContain('Done in') so the loud mode banner is explicitly
verified.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 69b1a4b5-723f-428b-a203-5fa34ece1cc4

📥 Commits

Reviewing files that changed from the base of the PR and between 0ebd27e and da6e41d.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • integrations/cli/index.test.ts
  • packages/@tailwindcss-cli/src/commands/build/index.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

@RobinMalfait RobinMalfait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I changed the --quiet flag to --silent because that's the name we talked about in the linked issue. As a non-native English speaker --silent is easier compared to --quiet (I often type --quite or --quit especially when typing fast).

Additionally, I also remove the Tailwind CSS header when the --silent option is passed such that only errors are present and nothing else.

@RobinMalfait RobinMalfait merged commit a480043 into tailwindlabs:main May 22, 2026
9 checks passed
@jordan-brough

Copy link
Copy Markdown
Contributor Author

Thank you for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants