Skip to content

NetWasm.UI 0.8.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 09:59
· 91 commits to main since this release

The first screen can now be rendered into the HTML at publish time, so visitors see content
before the Wasm has loaded:

<PropertyGroup>
  <NetWasmUIPrerender>true</NetWasmUIPrerender>
  <NetWasmUIPrerenderShell>404.html</NetWasmUIPrerenderShell>
</PropertyGroup>
<ItemGroup>
  <NetWasmUIPrerenderRoute Include="/about;/blog" />
</ItemGroup>

This is a snapshot, not hydration: links work right away, but event handlers start with the
app, which then replaces the markup. Hydration is planned next. The build runs the published
Wasm in the Node that NetWasm ships, so nothing more needs to be installed. See
Why Node and not .NET?.

Added

  • Prerendering (opt-in): with NetWasmUIPrerender=true, dotnet publish runs the app in Node
    for / and each NetWasmUIPrerenderRoute, and writes the rendered HTML into the mount
    element of index.html, about.html and so on. Content shows before the Wasm has loaded, and
    the app replaces it when it starts. NetWasmUIPrerenderShell writes a bare page, e.g.
    404.html, for the SPA fallback. See Prerendering.
  • The project website prerenders its home, examples and benchmarks pages.
  • nwui-dev serves /about from about.html when it exists, then 404.html, then
    index.html, as static hosts do.