Minify HTML output from an ASP.Net MVC Application

前端 未结 5 1131
余生分开走
余生分开走 2020-12-24 01:36

This is likely a duplicate of the below question but the only answer is a dead link:
Minify Html output of ASP.NET Application

When working with ASP.Net one of t

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-24 02:06

    Google Pagespeed will love this:

    I struggled for a while with this and the best way that I found was a combination of a few things:

    You can use my Helper Class MinifyHtmlAttribute on GitHubGist. It uses the Zeta Producer Html Compressor to minimize the HTML and with System.Web.Optimization's Bundling, to minimize inline javascript and CSS (for your critical css 0.0)

    Zeta Producer Html Compressor NuGet Package

    A .NET port of Google’s HtmlCompressor library to minify HTML source code.

    Now you can compress and minify your html with inline css and javascript being minified as well!! Awesome! ;)

    Hope someone finds this useful.

提交回复
热议问题