dotnet / dotnet/aspnetcore

dotnet watch (hot reload) can execute a process (target) before

Open
#31,924 2 comments 6 reactions 0 assignees View on GitHub
area-commandlinetools enhancement feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Description

The new hot reload works amazingly and it would be great if we can get some extension points, we can hook on, to teach it how to handle other kind of files.

### Describe the solution you'd like

1. One solution could be add the capability to include a target to be executed before the reload happens

```csproj


```

2. Provides a way to include our own `FileHandler` to `HotReload.cs`:

```csharp
public HotReload(ProcessRunner processRunner, IReporter reporter)
{
_staticFileHandler = new StaticFileHandler(reporter);
_scopedCssFileHandler = new ScopedCssFileHandler(processRunner, reporter);
_compilationHandler = new CompilationHandler(reporter);
}
```

### Additional context
The motivation for this is to give the chance to provide a unified experience when working on projects that integrate other tools like `nodejs postcss`.

For example this:

```csproj

```
is taken by a custom target that replaces `tailwind directives` on it and emits the result on `/bin/debug/net6.0/wwwroot`, I know this can be done by emitting the file directly on the project's `wwwroot` but having compiled files on it does not look elegant at all plus creates common confusions to new developers like "should I include this on source control?".

🌟 Thanks for taking the time to read through.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.