Removing spaces and comments from asp.net site

I have a website project with a lot of aspx sites. I would like to know if there is some tool that will allow me to remove all spaces and comments from aspx files? I don't want to do this at runtime because this is not optimal performance. I would like to do this before deploying.

Is there a ready-made tool, or should I write a simple console application that will use REGEX to eliminate unnecessary spaces and comments?

Regards, Adam

+2


source to share


2 answers


For what purpose? Confusion?

If you are just trying to reduce the size of HTTP responses for the end user, you are much better off telling the web server to use compression on your output. This silences whitespace to zero and gives much less results than "minimizing".



(If you don't store the loads <!-- comments -->

, in which case you should just change them to <%-- server-side comments --%>

.)

Don't try to handle ASP.NET with regex. Neither HTML nor aspx-templates are regular languages, and together they are much more complex than a regular expression can handle. Naive approaches like finding spaces outside of constructs <[^>]*>

are more likely to mess up your pages.

+1


source


Yes, there is no need to do this at runtime. Because it can be done at compile time. Check this link: http://omari-o.blogspot.com/2009/09/aspnet-white-space-cleaning-with-no.html



0


source







All Articles