-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add a feature to dotnet-watch to launch a browser and then auto-refresh it when changes are detected #23412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Rough overview of how this will work. We can update this as necessary. We'll add a new The middleware detects if the request response type is HTML and if so, injects a block of JavaScript that connects to a WebSocket that will communicate when the browser page should be reloaded.
When
As To trigger the JS block to initiate the browser window refresh, the server (whether Additionally, on first launch, |
Put it in another assembly outside of the shared framework. It can be in an assembly that ships with |
OK, fair. Let's scope it down to the |
* Introduce a middleware that can connect to the dotnet-watch change server * dotnet-watch: Inject the middleware in 3.1 or apps using start hooks \ hosting startup #23412
* Introduce a middleware that can connect to the dotnet-watch change server * dotnet-watch: Inject the middleware in 3.1 or apps using start hooks \ hosting startup #23412
* Introduce a middleware that can connect to the dotnet-watch change server * dotnet-watch: Inject the middleware in 3.1 or apps using start hooks \ hosting startup #23412
* Introduce a middleware that can connect to the dotnet-watch change server * dotnet-watch: Inject the middleware in 3.1 or apps using start hooks \ hosting startup #23412
* Add a middleware for browser refresh. * Introduce a middleware that can connect to the dotnet-watch change server * dotnet-watch: Inject the middleware in 3.1 or apps using start hooks \ hosting startup #23412 * Update src/Tools/dotnet-watch/BrowserRefresh/src/StartupHook.cs * Changes per PR comments * Add a test for reading the script * Changes per PR comments * Updates docs * Fixup test * Add project ref
As a start, we'd like for a way to launch a browser, once a server the server is listening. Once we have this, we can start looking at ways to refresh the current tab rather than launching a new instance. @DamianEdwards suggested looking at https://github.com/RickStrahl/Westwind.AspnetCore.LiveReload (cc @RickStrahl)'s middleware to see how that's achieved and if that's something we could incorporate in to dotnet-watch.
The text was updated successfully, but these errors were encountered: