dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.52k stars 25.31k forks source link

Update sample to use app.MapStaticAssets(staticAssetsManifestPath: myManifestKey); #33059

Open Rick-Anderson opened 1 month ago

Rick-Anderson commented 1 month ago

Description

Update the following code to use a manifest file and replace any app.UseStaticFiles(new StaticFileOptions code with

var myManifestKey = builder.Configuration["MyManifestPath"]
         ?? "manifests/manifest.json";

/// other code

 app.MapStaticAssets(staticAssetsManifestPath: myManifestKey);

Helpful links:

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/static-files.md

Document ID

3fec6e08-fc99-7a5c-796f-3f2347cad891

Article author

@Rick-Anderson

Rick-Anderson commented 1 month ago

@dazinator are you interested in updating app.UseStaticFiles(new StaticFileOptions to use app.MapStaticAssets(staticAssetsManifestPath: myManifestKey); ?

cc @Spacefish,