Skip to content

Ensure @tailwindcss/cli watches the input file#20246

Merged
RobinMalfait merged 4 commits into
mainfrom
fix/issue-17632
Jun 16, 2026
Merged

Ensure @tailwindcss/cli watches the input file#20246
RobinMalfait merged 4 commits into
mainfrom
fix/issue-17632

Conversation

@RobinMalfait

@RobinMalfait RobinMalfait commented Jun 16, 2026

Copy link
Copy Markdown
Member

This PR fixes an issue where if the --input file (when using @tailwindcss/cli) lives in an ignored folder, then changes to the input file won't trigger a rebuild.

This happened in #17632 where the input file lives in the assets/ folder which is ignored by default (because of the source (none)).

However, if you make a change to the input file, then the CLI doesn't restart which means that you can't update the @source directives without quitting the program and re-starting it manually.

This PR solves that by automatically injecting an @source with the path to the input file. This way the CLI will see changes, even if the input file is in an ignored directory.

Fixes: #17632

Test plan

  1. Added an integration test
  2. Existing tests pass
  3. Reproduced it on the

Before:
file-295ce4696b6b3199a3915c63f8bb50cd

After:
file-301b2f2e06aee045957355014ae5de87

This is typically handled automatically, but if the file lives in an
ignored folder then it won't trigger a rebuild. With this in place, we
force watching the input CSS file regardless of the .gitignore and
`@source` rules.
@RobinMalfait RobinMalfait requested a review from a team as a code owner June 16, 2026 16:22
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c40a3dc3-d936-4d41-92e1-dab31cd90279

📥 Commits

Reviewing files that changed from the base of the PR and between d06a8b1 and 801efbe.

📒 Files selected for processing (1)
  • CHANGELOG.md

Walkthrough

The build command's createCompiler function now conditionally appends the user-provided input file (as a base/pattern source entry) to the sources list when inputFilePath is non-null. Previously, the input file was not explicitly added, causing watch mode to miss changes when the file resided in a folder excluded by Tailwind's auto-source detection. A new integration test covers this scenario: a workspace configured with a custom assets source path runs the CLI in --watch mode, verifies initial output, mutates the CSS input, and asserts the rebuilt output reflects the change. The changelog is updated to document the fix.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: ensuring the CLI watches the input file, which directly addresses the core issue fixed in this PR.
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.
Description check ✅ Passed The pull request description clearly explains the issue (input files in ignored folders not triggering rebuilds) and describes the fix (automatically injecting @source directives).

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


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

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge. The change is a two-line addition inside createCompiler that mirrors the existing executable-negation entry and is guarded against the stdin case.

The fix is minimal and well-contained: it reuses the existing fullRebuildPaths mechanism that already knows how to trigger a full rebuild when the input file changes — the only missing piece was that the watcher never saw the file if its directory was ignored. Adding it as an explicit Scanner source closes that gap without touching any other logic. The integration test directly reproduces the bug scenario.

No files require special attention.

Reviews (2): Last reviewed commit: "update CHANGELOG" | Re-trigger Greptile

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.

tailwind watch mode not refreshing files in assets folder

1 participant