tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

tailwind watch mode not refreshing files in assets folder

Open kuon opened this issue 9 months ago • 10 comments

What version of Tailwind CSS are you using?

v4.1.3

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

tailwind cli

What version of Node.js are you using?

v23.4.0

What browser are you using?

firefox

What operating system are you using?

linux

Reproduction URL

https://github.com/kuon/bug-tailwind

Describe your issue

The watch does not work for files located in the "assets" folder.

I think this is the same issue.

kuon avatar Apr 10 '25 10:04 kuon

@kuon Hey! Can you clarify what the issue is that you're seeing? I've been running your repro and it seems like whenever I do make touch, the cli does seem to pick up the change? Is this specific to Linux?

https://github.com/user-attachments/assets/507e3766-b295-4a89-9b9a-3f3f2ab11797

philipp-spiess avatar Apr 11 '25 11:04 philipp-spiess

Yes, on Linux the CLI does not pick up the change. I tried on two machines to be sure it wasn't specific to my workstation.

-- Nicolas Goy Developer & Engineer

kuon avatar Apr 11 '25 12:04 kuon

It seems the reproduction is not 100% of the time. I am trying to find the conditions and I will give you an update.

kuon avatar Apr 11 '25 17:04 kuon

I updated the repo with some path modifications and now it does it 100% for me.

kuon avatar Apr 11 '25 17:04 kuon

Seems like it could be related to source(none)? Removing it and rerruning make causes make touch to cause rebuilds. Adding source(none) back in then stops make touch from causing rebuilds.

wongjn avatar Apr 11 '25 19:04 wongjn

Yes, but it should at least watch itself (the css file) even with source(none). Also the weird thing is that it is dependent on the folders it is located. As you saw the first time, it had source(none) and was working.

So I think there is some subtle bug somewhere.

kuon avatar Apr 11 '25 19:04 kuon

Yep! A bug somewhere 🐛 To be clear, I wasn't suggesting that it wasn't a bug. I was merely writing my findings in case it helps identify the root cause.

wongjn avatar Apr 11 '25 19:04 wongjn

TAILWIND_MODE=watch npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch

The main cause is a subtle bug in Tailwind's file watching logic, especially when source(none) is used and files are in certain folders on Linux. Removing source(none), using TAILWIND_MODE=watch, and ensuring your editor triggers proper file events are the best current workarounds

IsmeetKachhap007 avatar Jun 19 '25 11:06 IsmeetKachhap007