-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[v4] cli --watch seems to watch unneeded directories #15750
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
Comments
Still present with 4.0.3. Here is the output with $ DEBUG=1 npx @tailwindcss/cli -i scss/tailwind.css -o c/tailwind.css -m --watch
≈ tailwindcss v4.0.3
Done in 9s
[9972.22ms] [@tailwindcss/cli] (initial build)
[ 46.95ms] ↳ Setup compiler
[ 17.05ms] ↳ Scan for candidates
[ 43.13ms] ↳ Build CSS
[ 3.73ms] ↳ Optimize CSS
[ 0.73ms] ↳ Write output Without watch: $ DEBUG=1 npx @tailwindcss/cli -i scss/tailwind.css -o c/tailwind.css -m
≈ tailwindcss v4.0.3
Done in 118ms
[120.28ms] [@tailwindcss/cli] (initial build)
[ 29.14ms] ↳ Setup compiler
[ 31.18ms] ↳ Scan for candidates
[ 46.82ms] ↳ Build CSS
[ 3.82ms] ↳ Optimize CSS
[ 0.46ms] ↳ Write output |
I've also observed this behavior. My test caseProject:
Contents of @import "tailwindcss" source(none);
@source "../index.html"; Command:
I would expect HypothesisI think the watcher discards filename and watches all of |
Good idea! That makes sense and would explain the behaviour. |
@doits Hey! Sorry for the late reply here. Unfortunately that's an implementation detail that we can't really fix. We use I'm not sure why it takes 9 seconds to set up the single watcher for you, though. Do you have |
Thanks for the reply! I just run it with
Maybe this helps to see where it takes so much time?
I have a lot of directories inside my project, parts of |
@doits Thanks! Will investigate further. What version of |
v4.1.6 |
What version of Tailwind CSS are you using?
v4.0.0
What build tool (or framework if it abstracts the build tool) are you using?
@twailwindcss/cli
What version of Node.js are you using?
v20.18.1
What browser are you using?
N/A
What operating system are you using?
Ubuntu 20.04
Reproduction URL
N/A
Describe your issue
I have the following directory structure:
My
scss/tailwind.css
looks like this:Reason: I only want tailwindcss to scan the php files in the root directory, nothing more, especially nothing in subdirectories.
Compiling works:
npx @tailwindcss/cli -i scss/tailwind.css -o c/tailwind.css -m ≈ tailwindcss v4.0.0 Done in 165ms
But when I add
--watch
:npx @tailwindcss/cli -i scss/tailwind.css -o c/tailwind.css -m --watch ≈ tailwindcss v4.0.0 Done in 9s
Notice how long it takes.
And sometimes I get this error:
What is it doing in
files/models/offerpdf
? It looks like it wants to watch this directory, but why? It isn't added to@source
at all.When I only source a subdirectory (
@source "../some_dir/*.php";
) the problem goes away.Is there something broken with setting up the watchers since v4? I had no problems with v3 with the same configuration (through a
tailwind.config.js
though, but same/similar pattern only watching*.php
in the root dir.).The text was updated successfully, but these errors were encountered: