Search code examples
asp.netasp.net-mvcoptimizationwhitespaceaction-filter

MVC 3 White space removal (most optimal alogritm)?


Right now i am using this WhiteSpace module from Mads Kristensen, http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx

Its working "ok" but it could be better (The output that i get could be reduced further from whitespaces). Does anyone have a good regex/algoritm to remove whitespaces? I mean, like the one google.com uses. Now thats efficient.

The only criteria that i have is that you can use it from inside and a MVC action filter.


Solution

  • You may checkout HTML Tidy. But remember that you will get much more benefit from compressing the output rather than tidying. Just watch for a caveat when doing this.