Jan 10 2007

CSSInHeaderCompression

Posted by admin under ASPCodeHeaderManager

 

How dows it work?

Pretty much the same as for javascript.

1. If appsettings debugmode = true then it never compresses the css file but instead just sets the link href='' path directly to the script.

All we can do with CSS files are CSSInHeaderCompression = 0 (none) or CSSInHeaderCompression = 1 (remove whitespace).  

Now our handler is called instead. That code is found in JSHandler.cs - I basically read the file from disk - packs it according to CSSInHeaderCompression (using Mads Kristensens code)  and then just returns it as contentype=text/css.

Removing whitespace from CSS files looks to be even more  sensitive than javascripts when it comes to semantics etc - so you might find that a certain css you are using is not functioning when packed - so please look at the advanced section on how to override packing for specific files.