Skip to content

[v4] cli --watch seems to watch unneeded directories #15750

Open
@doits

Description

@doits

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:

scss/tailwind.css

another.php
index.php

files/models/A_LOT_OF_DIRECTORIES # <-- 1000+ dirs

My scss/tailwind.css looks like this:

@layer theme, base, components, utilities;

@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities) source(none);

@source "../*.php";

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:

node:internal/process/promises:391
    triggerUncaughtException(err, true /* fromPromise */);
    ^

[Error: inotify_add_watch on '/path/to/project/root/files/models/offerpdf/755411' failed: No space left on device]

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.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions