• v2.0.8 121eb95d87

    2.0.8 Stable

    danieljsummers released this 2025-12-28 17:09:43 +00:00 | 0 commits to main since this release

    Package-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.local will create an XmlNode to load the package-provided script.
    • Script.minified and Script.unminified are now deprecated; these will remain in v2, but will be removed in the v4 packages. The new names for those are Script.cdnMinified and Script.cdnUnminified.

    For users of Giraffe.Htmx without Giraffe.ViewEngine.Htmx:

    • HtmxScript.local is an HtmlString with a script tag 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 of app.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