Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4] Tailwind CLI ignores .gitignore in watch mode #15684

Closed
condemil opened this issue Jan 21, 2025 · 5 comments · Fixed by #17255
Closed

[v4] Tailwind CLI ignores .gitignore in watch mode #15684

condemil opened this issue Jan 21, 2025 · 5 comments · Fixed by #17255
Labels

Comments

@condemil
Copy link

What version of Tailwind CSS are you using?

v4.0.0-beta.9

What build tool (or framework if it abstracts the build tool) are you using?

@tailwindcss/cli@4.0.0-beta.9

What version of Node.js are you using?

$ node --version
v23.5.0

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction URL

git clone https://gist.github.com/condemil/b9990c17d419a0d9d1f0cc0f637fdb3c tw4-watch-gitignore-repro

Describe your issue

When tailwindcss cli is running in watch mode and ignored file is modified the output will contain css from the ignored file:

To reproduce:

  1. Run the tailwindcss cli in watch mode
$ DEBUG=1 npx @tailwindcss/cli@4.0.0-beta.9 -i input.css -o output.css -w
≈ tailwindcss v4.0.0-beta.9

Done in 35ms

[36.26ms] [@tailwindcss/cli] (initial build)
[ 9.24ms]   ↳ Setup compiler
[ 7.97ms]   ↳ Scan for candidates
[10.85ms]   ↳ Build CSS
[ 1.84ms]   ↳ Write output
  1. Check that output.css doesn't have h-100
$ cat output.css | grep h-1
$
  1. Modify test.go and observe tailwindcss cli log
Done in 11ms

[11.25ms] [@tailwindcss/cli] (watcher)
[ 1.66ms]   ↳ Scan for candidates
[ 7.72ms]   ↳ Build CSS
[ 1.64ms]   ↳ Write output
  1. Check that output.css now have h-100
$ cat output.css | grep h-1
  .h-100 {
@condemil
Copy link
Author

condemil commented Jan 22, 2025

I assume watch mode also picks up output.css. If I specify duration-700 and after I change it to duration-800, the old value (duration-700) stays in output.css until I restart tailwindcss cli.

Edit: As mentioned below by @wongjn this is expected for the old values to stay in output.css, this comment can be ignored, but the initial issue is still valid.

@wongjn
Copy link
Contributor

wongjn commented Jan 22, 2025

I believe what you've described is intended behavior to keep things fast, see #14180, #4098

@condemil
Copy link
Author

@wongjn you're right, let's forget that the old values stays in output.css. Still, the data in .gitignore file should be respected to prevent watching for ignored files/directories.

@ur5us
Copy link

ur5us commented Mar 5, 2025

This is a big problem if you work on an app that logs periodically, s. rails/tailwindcss-rails#491 (comment).

@jamesremuscat
Copy link

Tailwind is also watching .git for changes, which doesn't seem right either...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@ur5us @philipp-spiess @condemil @jamesremuscat @wongjn and others