-
2.0.8 Stable
released this
2025-12-28 17:09:43 +00:00 | 0 commits to main since this releasePackage-Provided Script
This package now contains the htmx library script as a static web asset, which means that projects can serve htmx as a local script, rather than relying on a CDN.
For users of
Giraffe.ViewEngine.Htmx:Script.localwill create anXmlNodeto load the package-provided script.Script.minifiedandScript.unminifiedare now deprecated; these will remain in v2, but will be removed in the v4 packages. The new names for those areScript.cdnMinifiedandScript.cdnUnminified.
For users of
Giraffe.HtmxwithoutGiraffe.ViewEngine.Htmx:HtmxScript.localis anHtmlStringwith ascripttag to load the package-provided script. It can be written to the output, added in a Razor view, etc.
In either case, there may be slight changes needed for these static assets to be served.
- They are automatically available when the application is run in Development mode, and are included in published output.
- If running locally, calling
builder.UseStaticWebAssets()will enable them. - Consider adding
app.MapStaticAssets()(new in .NET 9) in the place ofapp.UseStaticFiles(). The former will process assets at build time and creates files necessary for efficient serving of these files. For more info, see Microsoft's static file documentation.
Using the local script can bring many benefits. One of HTTP 3's improvements was sending many files over the same connection, eliminating connection overhead. It also reduces dependence on an external site; CDNs can have issues, but if they go down, your site may not work either. Removing the CDN from a Content Security Policy (CSP) header also reduces the attack surface on your application.
Other Changes
- This package now directly supports .NET 10.
- The CDN links pull v2.0.8.
Downloads