Skip to content

hosting: serve the companion script from static web assets - #65

Merged
rameel merged 2 commits into
mainfrom
script-assets
Sep 26, 2026
Merged

rameel merged 2 commits into
mainfrom
script-assets

Conversation

@rameel

@rameel rameel commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

The companion script is now shipped as a static web asset instead of an embedded resource served by a custom endpoint. The library uses the Razor SDK and exposes the script at the standard _content/Ramstack.HtmxToolkit/htmx-toolkit.min.js path.

Static file handling and caching move to the application:

  • MapStaticAssets() on .NET 9+,
  • UseStaticFiles() on .NET 6–8.

This removes MapHtmxToolkitScript(), Html.HtmxToolkitScriptPath(), and Html.HtmxToolkitScript() helpers.

Package the script under wwwroot as ASP.NET Core static web assets and
switch the project to Microsoft.NET.Sdk.Razor. Applications reference
the files from the layout with an application-relative URL instead of
mapping an endpoint.

Remove MapHtmxToolkitScript, the HtmxToolkitScript and
HtmxToolkitScriptPath helpers, and the embedded HtmxAssets class.

The standard script Tag Helper resolves the packaged path: on ASP.NET
Core 9 or later it selects a fingerprinted URL when the page endpoint
has an asset collection, otherwise asp-append-version appends a
content-based query version through IFileVersionProvider.
@rameel
rameel merged commit 51a4675 into main Sep 26, 2026
1 check passed
@rameel
rameel deleted the script-assets branch September 26, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant