Skip to content

Commit f662d7f

Browse files
committed
Updates
1 parent e0e8f1f commit f662d7f

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

aspnetcore/blazor/fundamentals/environments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For a standalone Blazor WebAssembly app, set the environment with the `<WasmAppl
4848
<WasmApplicationEnvironmentName>Staging</WasmApplicationEnvironmentName>
4949
```
5050

51-
The default environment is `Development` when running the app locally and `Production` when the app is published.
51+
The default environments are `Development` for build and `Production` for publish.
5252

5353
:::moniker-end
5454

aspnetcore/blazor/fundamentals/static-files.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,19 @@ For examples of how to address the policy violation with Subresource Integrity (
196196

197197
:::moniker-end
198198

199+
:::moniker range="< aspnetcore-9.0"
200+
201+
Configure Static File Middleware to serve static assets to clients by calling <xref:Microsoft.AspNetCore.Builder.StaticFileExtensions.UseStaticFiles%2A> in the app's request processing pipeline. For more information, see <xref:fundamentals/static-files>.
202+
203+
In releases prior to .NET 8, Blazor framework static files, such as the Blazor script, are served via Static File Middleware. In .NET 8 or later, Blazor framework static files are mapped using endpoint routing, and Static File Middleware is no longer used.
204+
205+
:::moniker-end
206+
199207
:::moniker range=">= aspnetcore-10.0"
200208

201-
### Fingerprint client-side static assets
209+
## Fingerprint client-side static assets in standalone Blazor WebAssembly apps
202210

203-
In standalone Blazor WebAssembly apps during build/publish, the framework overrides placeholders in `index.html` with values computed during build to fingerprint static assets for client-side rendering (CSR). A [fingerprint](https://en.wikipedia.org/wiki/Fingerprint_(computing)) is placed into the `blazor.webassembly.js` script file name, and an import map is generated for other .NET assets.
211+
In standalone Blazor WebAssembly apps during build/publish, the framework overrides placeholders in `index.html` with values computed during build to fingerprint static assets for client-side rendering. A [fingerprint](https://wikipedia.org/wiki/Fingerprint_(computing)) is placed into the `blazor.webassembly.js` script file name, and an import map is generated for other .NET assets.
204212

205213
The following configuration must be present in the `wwwwoot/index.html` file of a standalone Blazor WebAssembly app to adopt fingerprinting:
206214

@@ -223,43 +231,30 @@ The following configuration must be present in the `wwwwoot/index.html` file of
223231
In the project file (`.csproj`), the `<OverrideHtmlAssetPlaceholders>` property is set to `true`:
224232

225233
```xml
226-
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
227-
<PropertyGroup>
228-
...
229-
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
230-
...
231-
</PropertyGroup>
232-
</Project>
234+
<PropertyGroup>
235+
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
236+
</PropertyGroup>
233237
```
234238

235-
For CSR in Blazor Web Apps (Interactive Auto or Interactive WebAssembly render modes), static asset server-side fingerprinting is enabled by adopting [Map Static Assets routing endpoint conventions (`MapStaticAssets`)](xref:fundamentals/map-static-files) and the [`ImportMap` component](xref:blazor/fundamentals/static-files#importmap-component).
239+
When resolving imports for JavaScript interop, the import map is used by the browser resolve fingerprinted files.
236240

237-
To fingerprint additional JavaScript modules for CSR, use the `<StaticWebAssetFingerprintPattern>` property in the app's project file (`.csproj`).
241+
## Fingerprint client-side static assets in Blazor Web Apps
238242

239-
In the following example, a fingerprint is added for all developer-supplied `.mjs` files in the app:
243+
For client-side rendering (CSR) in Blazor Web Apps (Interactive Auto or Interactive WebAssembly render modes), static asset server-side [fingerprinting](https://wikipedia.org/wiki/Fingerprint_(computing)) is enabled by adopting [Map Static Assets routing endpoint conventions (`MapStaticAssets`)](xref:fundamentals/map-static-files), [`ImportMap` component](xref:blazor/fundamentals/static-files#importmap-component), and the <xref:Microsoft.AspNetCore.Components.ComponentBase.Assets?displayProperty=nameWithType> property (`@Assets["..."]`).
244+
245+
To fingerprint additional JavaScript modules for CSR, use the `<StaticWebAssetFingerprintPattern>` item in the app's project file (`.csproj`). In the following example, a fingerprint is added for all developer-supplied `.mjs` files in the app:
240246

241247
```xml
242-
<StaticWebAssetFingerprintPattern Include="JSModule" Pattern="*.mjs"
243-
Expression="#[.{fingerprint}]!" />
248+
<ItemGroup>
249+
<StaticWebAssetFingerprintPattern Include="JSModule" Pattern="*.mjs"
250+
Expression="#[.{fingerprint}]!" />
251+
</ItemGroup>
244252
```
245253

246-
The files are automatically placed into the import map:
247-
248-
* Automatically for Blazor Web App CSR.
249-
* When opting-into module fingerprinting in standalone Blazor WebAssembly apps per the preceding instructions.
250-
251-
When resolving the import for JavaScript interop, the import map is used by the browser resolve fingerprinted files.
254+
When resolving imports for JavaScript interop, the import map is used by the browser resolve fingerprinted files.
252255

253256
:::moniker-end
254257

255-
:::moniker range="< aspnetcore-9.0"
256-
257-
Configure Static File Middleware to serve static assets to clients by calling <xref:Microsoft.AspNetCore.Builder.StaticFileExtensions.UseStaticFiles%2A> in the app's request processing pipeline. For more information, see <xref:fundamentals/static-files>.
258-
259-
:::moniker-end
260-
261-
In releases prior to .NET 8, Blazor framework static files, such as the Blazor script, are served via Static File Middleware. In .NET 8 or later, Blazor framework static files are mapped using endpoint routing, and Static File Middleware is no longer used.
262-
263258
## Summary of static file `<link>` `href` formats
264259

265260
*This section applies to all .NET releases and Blazor apps.*

0 commit comments

Comments
 (0)