question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tailwindcss in watch mode doesn't refresh outupt when files are changed using vim

See original GitHub issue

This is based on #7679 - the versions being used are listed there.

I ended up setting up test-case project here: https://github.com/javornikolov/tailwindcss-issue-7679 There is Github Actions CI job which outlines the changes I do to reproduce the issue. However the issue does’t occur when running the automated scripts. It occurs when I manually edit the file using vim editor (doing the same changes).

vim version is 8.2

  • The issue is not observed If I copy/paste files from template/* to src.
  • The issue is (usually) not observed if I use other text editor - gedit. Or if I also touch files (using touch -m). (Sometimes touch doesn’t help either - that’s more subtle, I am not sure how to consistently reproduce yet.)

Sometimes refresh of output.css happens when I use vim too but it’s quite rare (and is after some modifications of file outside of vim as well).


Steps to reproduce - based on the GithHub repo above:

  • start tailwindcss --watch (e.g. via npx pm2 start ecosystem.config.js)
  • Modify src/tailwind.css copy-pasting the content of templates/tailwind.css.2 usingvim.
  • Similarly modify src/index.html (using index.html.2)
  • What happens is that in output.css I only have btn-cool-1 but not btn-cool-2. I uploaded the state of the files to branch topic/after-change-using-vim in the same github repo. I included some stat outputs in case that matters.

If I switch the order of modifying tailwind.css and index.html and I edit index.html first - then nor btn-cool-1, nor btn-cool-2 are included

Hypothesys

I suspect that the way vim saves files has specifics which are not yet recognized as changes to source files. Perhaps it can be reproduced outside vim, I am just not fully aware in what exactly way yet. Some insights might be possibly found e.g. here: https://vi.stackexchange.com/questions/25030/vim-not-firing-inotify-events-when-writing-file

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mrinxcommented, Mar 7, 2022

Hey! Have you tried to set :set backupcopy=yes as mentioned in your Stack Exchange link? It seems like that should solve your issue.

1reaction
thecrypticacecommented, Nov 10, 2022

@carderne I merged in another fix. It appears to work for me on Linux. Would you mind giving the insiders build a test? npm install tailwindcss@insiders

Read more comments on GitHub >

github_iconTop Results From Across the Web

Editor Setup - Tailwind CSS
Editor Setup. Plugins and configuration settings that can improve the developer experience when working with Tailwind CSS.
Read more >
Why styles don't update when saving the files in Tailwind CSS ...
While trying to use Tailwind with React in JIT mode the classes that I add have no styles, even after refreshing the page....
Read more >
HubSpot CLI commands
Watch your local directory and automatically upload changes to your HubSpot account on file saves. Any changes made when saving will be live ......
Read more >
Why I Don't Like Tailwind CSS | Aleksandr Hovhannisyan
With Tailwind, tweaking styles in this manner is difficult because you're no longer dealing with classes that apply styles to multiple elements.
Read more >
Changelog | Meteor API Docs
If there is an error on index creation Meteor will output a better ... Fix Meteor sometimes not detecting changes to a file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found