Strut.CleanHtml 1.0.16

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Strut.CleanHtml --version 1.0.16
                    
NuGet\Install-Package Strut.CleanHtml -Version 1.0.16
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Strut.CleanHtml" Version="1.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Strut.CleanHtml" Version="1.0.16" />
                    
Directory.Packages.props
<PackageReference Include="Strut.CleanHtml" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Strut.CleanHtml --version 1.0.16
                    
#r "nuget: Strut.CleanHtml, 1.0.16"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Strut.CleanHtml@1.0.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Strut.CleanHtml&version=1.0.16
                    
Install as a Cake Addin
#tool nuget:?package=Strut.CleanHtml&version=1.0.16
                    
Install as a Cake Tool

Strut.CleanHtml

NuGet

ASP.NET Core middleware that removes unnecessary whitespace from HTML responses to reduce payload size.

Features

  • Collapses consecutive whitespace characters into single spaces
  • Strips whitespace between HTML tags
  • Preserves content inside <script>, <style>, ``, <![CDATA[...]]>, and <!DOCTYPE> blocks
  • Case-insensitive tag detection
  • High-performance in-place byte-level processing (no string allocations)
  • Only processes text/html responses; other content types pass through unchanged

Usage

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.UseCleanHtml();

app.Run();

Register the middleware early in the pipeline so it wraps subsequent middleware that produces HTML output.

How it works

The middleware intercepts the response stream, buffers the HTML output, then performs a single-pass in-place optimization over the byte buffer. It tracks parsing state (inside tags, scripts, styles, comments, CDATA, DOCTYPE) to decide where whitespace can safely be removed.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated