Walter.Web.HtmlTools.HtmlMinify 1.0.0.2

This package allows you to minify HTML generated by MVC projects making the response generally smaller as well as less readable for those that want to copy or work.

Install-Package Walter.Web.HtmlTools.HtmlMinify -Version 1.0.0.2
dotnet add package Walter.Web.HtmlTools.HtmlMinify --version 1.0.0.2
<PackageReference Include="Walter.Web.HtmlTools.HtmlMinify" Version="1.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Walter.Web.HtmlTools.HtmlMinify --version 1.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Razor page Minifier

After installing the nuget package you open
Startup.cs and add the following using clause

using Walter.Web.HtmlTools.HtmlMinify;

Then add UseHTMLMinification in the configure section

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
   //add minification
   app.UseHTMLMinification();
}

Not supported is having singe lined comments in your javascript as all behind this line will be commented out

<script>
//BAD idea
alert("will never get called");

</script>

You can use multi line comments as this will work if all is on one line

<script>
    /*this will work*/
    alert("Hello world");
</script>

At all times try and avoid using the script tag in your pages as for this to work you need to tell
the browser to allow executing script in the page opening you to Cross-site scripting (XSS). Better put all javascript in a .js file and load that.

Razor page Minifier

After installing the nuget package you open
Startup.cs and add the following using clause

using Walter.Web.HtmlTools.HtmlMinify;

Then add UseHTMLMinification in the configure section

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
   //add minification
   app.UseHTMLMinification();
}

Not supported is having singe lined comments in your javascript as all behind this line will be commented out

<script>
//BAD idea
alert("will never get called");

</script>

You can use multi line comments as this will work if all is on one line

<script>
    /*this will work*/
    alert("Hello world");
</script>

At all times try and avoid using the script tag in your pages as for this to work you need to tell
the browser to allow executing script in the page opening you to Cross-site scripting (XSS). Better put all javascript in a .js file and load that.

Release Notes

First release no bugs logged

GitHub repositories (0)

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0.2 90 12/21/2019