Tailwind CLI's --watch not working properly. #9031
Replies: 6 comments 5 replies
-
Hello @mostafizurtaif, I've got the same issue. Did you find any fix to it? |
Beta Was this translation helpful? Give feedback.
-
I'm having this issue as well. |
Beta Was this translation helpful? Give feedback.
-
1 year later no update? using latest tailwind still produce the same thing |
Beta Was this translation helpful? Give feedback.
-
I'm new to Tailwind CSS and noticed two unexpected things when trying to use the First, it appears that when watching for changes, only new classes or modifications were being updated. When removing classes on some elements, they were not optimized out on a watch event (only removed if I restarted tailwindcss). This made me believe the utility was not watching when I toggled the use of some classes in some HTML templates, but maybe there is a design reason to only add new/updated styles in a watch event. Second, I had created a Bash script to perform a series of watch-related actions, one being using tailwindcss. When invoked in this script, it was closing stdin for tailwindcss, which appears to stop the program from watching. To workaround this, I updated the watch request to always occur ( (Windows; tailwindcss 3.4.1) |
Beta Was this translation helpful? Give feedback.
-
Still don't work, as a work around I use: "build:tailwind": "tailwindcss -i src/styles.css -o dist/css/styles.css", Then I use chokidar to watch the file. I also tried what @jdknight mentioned Tried versions 3.4.14 and 3.4.13 |
Beta Was this translation helpful? Give feedback.
-
You can give this solution a try |
Beta Was this translation helpful? Give feedback.
-
Each time I add a new class to the
index.html
file, I need to rebuild theoutput.css
file manually.The
package.json
file:The
tailwind.config.js
file:I am supposed to run
npm run build
once, and each time I saved the html file, tailwind is supposed to add my new classes tooutput.css
. But it doesn't. I checked the file after savingindex.html
and I couldn't find my new classes there. But the CLI shamelessly said it rebuilt it in 20ms. I needed to runnpm run build
each time to successfully build my css file. Also, I deleted my previous nodejs installation and reinstalled the current version, updated VS Code, updated Google Chrome, and now, I am considering moving back to Windows from Manjaro.Some useful observations:
After saving
index.html
, the CLI said this:But when I stopped the process and reran
npm run build
, it said:There is a relatively huge time delay when it actually works.
Also, it works when I hit the
S
button while pressingCtrl
multiple times. In other words, if I saveindex.html
multiple times rapidly, it works fine.Beta Was this translation helpful? Give feedback.
All reactions