PeteT
PeteT

Reputation: 19180

asp.net publish with whitespace removed

Obviously having whitespace in css, aspx and html pages is a great advantage at design time. But is there a way to (a tool that will) clear all the whitespace from all the files and possibly merge javascript and css files in a more optimal way.

I am using asp.net themes so there are quite a lot of separate css files that would be improved through some form of automated combining. I have seen a few http modules but that isn't quite what I want I just want to run something over the published project beofre sending it to the server.

EDIT: Compression at least in IIS is unfortunately not an option, we are currently running it on the same IIS server as a third party web based student management system. It doesn't like compression and the IIS options don't seem to be per application pool. I did apply asp.net compression but the bulk of my extra data seems to be the app_themes which I know would compress well I just don't want to have to manually go through compressing all the css separately.

Upvotes: 2

Views: 2532

Answers (5)

Elmer
Elmer

Reputation: 9437

i found this:

http://msdn.microsoft.com/en-us/library/aa719805(VS.71).aspx

greets!

Upvotes: 0

MatthewMartin
MatthewMartin

Reputation: 33153

4 guys from Rolla just published an article on a http module that removes white space. You would need IIS 7 in integrated mode to make it work for css (or possibly IIS6 with wildcard mappings)

It looks more like a proof of concept, but the code is free.

Upvotes: 1

Dave Markle
Dave Markle

Reputation: 97771

I think one of the reasons that this was never included in .NET was because they expected you to turn on server compression in these scenarios. IMO I don't agree with this -- I think it's a shame that at least aspnet_compiler.exe can't do this optimization. It would be such a great performance boost on uncompressed connections. Anyway, you can enable compression on IIS 6:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx?mfr=true

And it's even easier and more flexible in IIS7 to do so. I hope someone has a better solution than I!

Upvotes: 1

MatthewMartin
MatthewMartin

Reputation: 33153

An empirical study on the effect of removing white space from a not-untypical website (Drupal) showed minimal effects. (site also contains some links to non .net html white space removal tools)

I have gotten magical improvements in page size by aggressively managing viewstate size and using Blowery's http compression module.

Another strategy is to do minifiation (merging many css files into one). Telerik has such a component RadStyleSheetManager, it works only with style sheets embedded into assemblies.

Upvotes: 2

Related Questions