C# port of Google’s htmlcompressor library

Since I was in the need of a stand-alone HTML compression library (also called „minify“/“minification“), I quickly ported Googles htmlcompressor library from Java to .NET (C#).

Download the sources

Please note that I only ported the core functionality (i.e. not the command line stuff) and omitted the YUI compressor calls (JavaScript and CSS) since I do not need it right now.

All HTML unit tests ran successfully, I also did about an additional 50+ tests of uncompressed, real-world comples HTML pages both with my implementation and Google’s just to see that both versions produce 100% exact results.

Thanks to this Stack Overflow posting for helping on migrating.

Update 2015-10-19

There is now a NuGet package and a GitHub project for this library.

5 Gedanken zu „C# port of Google’s htmlcompressor library

  1. Robert McKee sagt:

    Form attribute removal will remove all attributes that end with method=“get“, including the ASP.NET AJAX attribute data-ajax-method=“get“ which then causes the ajax request to do a POST instead.

  2. I used this for a while but it seemed to have some issues that caused the cpu to spike. I only saw this occasionally and only on a chinese translated version of my site. I had to remove it. Shame, it looked really promising.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.