https://github.com/abiosoft/devreload
Auto reload for ASP.NET core development
https://github.com/abiosoft/devreload
asp-net-core livereload
Last synced: about 1 year ago
JSON representation
Auto reload for ASP.NET core development
- Host: GitHub
- URL: https://github.com/abiosoft/devreload
- Owner: abiosoft
- License: gpl-3.0
- Created: 2019-07-27T17:58:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T19:12:05.000Z (over 5 years ago)
- Last Synced: 2025-03-16T13:47:53.462Z (over 1 year ago)
- Topics: asp-net-core, livereload
- Language: C#
- Homepage:
- Size: 1.92 MB
- Stars: 61
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DevReload
[](https://www.nuget.org/packages/Abiosoft.DotNet.DevReload)
Live reload for ASP.NET core development.
## Install
```sh
dotnet add package Abiosoft.DotNet.DevReload --version 0.1.4
```
## Usage
Use the middleware. Usually in `Startup.cs`
```csharp
using Abiosoft.DotNet.DevReload;
...
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDevReload();
}
...
}
```
Then, add the tag helper to your main layout file.
```cshtml
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Abiosoft.DotNet.DevReload
...
```
And that's all. Just use `dotnet watch run` and your browser will auto reload.
## How
DevReload monitors the ASP.NET app by long polling a REST endpoint and monitor static files with FileSystemWatcher.
## Configure
You can modify the directories and file extensions for static files only.
**_Note_** that live editing of `cshtml` files may require Razor Runtime Compilation service.
```csharp
app.UseDevReload(new DevReloadOptions
{
Directory = ".",
IgnoredSubDirectories = new string[] { ".git", ".node_modules" },
StaticFileExtensions = new string[] { "cshtml", "css", "js", "html" },
});
```
## Demonstration
