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.

CLI watch mode not working correctly when using visual studio

See original GitHub issue

What version of Tailwind CSS are you using?

TailwindCSS CLI: v3.2.1 Visual Studio: 2022 - Version 17.3.6

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

Visual Studio

What operating system are you using?

Windows 10

Describe your issue

the tailwind cli in watcher mode: tailwind.exe -i ./Styles/site.css -o ./wwwroot/css/site.css --watch --verbose edit a .razor or cshtml file with Notepad++ and save the file - the watcher sees the change and rebuilds correctly

but when i open visual studio and edit the exact same file in vstudio, and save the file, nothing happens. as you can see on the screenshot, notepad++ detects there is a change, but the tailwind cli tool does not

image

config:

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: ["./**/*.{razor,html,cshtml}"],
    theme: {
        extend: {},
    },
    plugins: [],
}

i then made a copy of a cshtml file in windows explorer, and noticed the watcher is not reacting on the new file as well. only when i restart the cli tool, edits in the new file trigger a rebuild. this made me investigate some more: changing the configuration to content: ["./Pages/*.*"],

and saving a .razor page in visual studio in this folder leads to this crash:

image

looks like visual studio is saving files via a temp file, and then renames it. this way the cli watcher doesn’t see it anymore. is this possible to fix? or is this just happening on my computer? 😃

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:9

github_iconTop GitHub Comments

2reactions
pm64commented, Oct 27, 2022

EDIT: I stepped back through each release, this appears to have started in 3.1.8.

I’m experiencing similar behavior.

From what I’m observing, if Visual Studio is used to edit any source file during a Tailwind CSS watcher session, the watcher does not rebuild in response to that change, and becomes oblivious to all subsequent changes, whether they took place in Visual Studio, Notepad++, or whatever (however – in my case, even using the --verbose option, Tailwind CSS does not display any indication of an exception).

If you then terminate and re-start Tailwind CSS, the watcher’s behavior returns to normal (rebuilding in response to changes made in Notepad++, for example), until Visual Studio is used to make another change.

Edit: @tecxx if this is a different problem than what you’re experiencing, let me know and I’ll move this to a new issue.

0reactions
thecrypticacecommented, Nov 3, 2022

Hey all, I merged a PR by @natrys that should fix these problems. If you could give the latest insiders build a test and report back here it would be much appreciated:

npm install tailwindcss@insiders

I’ve done some testing on my own and it appears that Visual Studio on Windows is finally working again and VIM on Linux (and WSL even) when it performs backups for saves.

Note: that WSL fs events are effectively broken under /mnt/{a,b,c,d,…} so you have to use --poll or be in a different, non-shared mount.

Gonna close as we believe the issue has been fixed but will re-open if there turns out to be more things we need to address w/ regards to the CLI watching.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to watch for file changes "dotnet watch" with Visual ...
Net 5 & 6. In VisualStudio 2019. Go to Tools > ⚙ Options > Projects and Solutions > ASP .NET Core; Select Auto...
Read more >
Troubleshoot Terminal launch failures - Visual Studio Code
To troubleshoot Integrated Terminal launch failures in Visual Studio Code, follow these steps to diagnose issues: Check your user settings.
Read more >
Unable to execute Angular CLI commands in Visual Studio ...
In this video , I am going to fix that error :Unable to execute Angular CLI commands in Visual Studio Code terminalWhen you...
Read more >
Develop ASP.NET Core apps using a file watcher
NET Core CLI's file watcher (dotnet watch) tool in an ASP.NET Core app. ... That problem is fixed later in the tutorial.
Read more >
Tips and tricks in the debugger - Visual Studio - Microsoft Learn
Pin data tips; Edit your code and continue debugging (C#, VB, C++); Edit XAML code and continue debugging; Debug issues that are hard...
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