hosting: serve the companion script from static web assets - #65
Merged
Merged
Conversation
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
force-pushed
the
script-assets
branch
from
September 26, 2026 14:51
9cdb4ff to
f87ccd0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jspath.Static file handling and caching move to the application:
MapStaticAssets()on .NET 9+,UseStaticFiles()on .NET 6–8.This removes
MapHtmxToolkitScript(),Html.HtmxToolkitScriptPath(), andHtml.HtmxToolkitScript()helpers.