-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af1d4bb
commit 2899705
Showing
1 changed file
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,55 @@ | ||
# docFxWebAppRefresh | ||
DocFx .net core web app build middleware. Rebuilds docFx assets when files are changed in a web app. | ||
# ElCamino.DocFx.WebAppRefresh | ||
DocFx build middleware that allows you to setup a .net core web app project and adds a file watcher to your content files. When you change a content file, such as markdown, css, etc, the middleware automatically starts a docFx build in the background regenerating the target html files. | ||
|
||
**This library should be configured for local development only as shown below!** | ||
1. Create a new .net core web application 'Empty' project | ||
``` | ||
dotnet new web | ||
``` | ||
or | ||
|
||
Use Visual Studio new project, web application, Empty. | ||
|
||
2. Use the nuget package manager to install **docfx.console** | ||
``` | ||
dotnet add package docfx.console | ||
``` | ||
3. **Build** the project (this will generate all of the docfx files) | ||
4. Rename the **_site** folder to **wwwroot**. | ||
5. Edit the *.gitignore* file, remove **_site**, add **wwwroot** and **log.txt** | ||
``` | ||
wwwroot | ||
log.txt | ||
``` | ||
6. Edit the *docfx.json*, rename **_site** and replace with **wwwroot** | ||
```json | ||
{... | ||
"dest": "wwwroot", | ||
... | ||
} | ||
``` | ||
7. Use the nuget package manager to install **ElCamino.DocFx.WebAppRefresh** | ||
``` | ||
dotnet add package ElCamino.DocFx.WebAppRefresh | ||
``` | ||
8. Edit the Startup.cs | ||
```c# | ||
public class Startup | ||
{ | ||
... | ||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | ||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
// only use in development, not for production | ||
app.UseDocFxBuildRefresh(env.ContentRootPath, env.WebRootPath); | ||
} | ||
app.UseDefaultFiles(); | ||
|
||
app.UseStaticFiles(); | ||
} | ||
... | ||
``` | ||
9. Debug the web application. Change a content file (markdown, css, etc) and watch the debug output for the docFx build output and refresh the page to see your changes. |