Geeks With Blogs

Michael Freidgeim's Blog MS .Net Development
There are multiple ways and techniques how to combine and minify JS and CSS files.
The good number of links can be found in
and in

There are 2 major approaches- do it during build or at run-time.

In our application there are multiple user-controls, each of them required different JS or CSS files, and they loaded dynamically in the different combinations. We decided that loading all JS or CSS files for each page is not a good idea, but for each page we need to load different set of files.
Based on this combining files on the build stage does not looks feasible.
After Reviewing  different links I’ve decided that squishit should fit to our needs.

Different limitations of using SquishIt.
We had some browser specific CSS files, that loaded conditionally depending of browser type(i.e IE and all other browsers). We had to put them in separate bundles,

For Resources and AXD files we decide to use HttpModule and HttpHandler created by Mads Kristensen

To GZIP html we are using wwWebUtils.GZipEncodePage() Just swap the order of which encoding you apply to start by asking for deflate support and then GZip afterwards.

Additional tips about SquishIt.

Use CDN:
Support intellisense and generate bundle in codebehind

Links about other Libraries that were considered

A few links from

.Net 4.5 will have out-of-the-box tools for JS/CSS combining. . It suggests default bundle of subfolder, but also seems supporting similar to squishit explicitly specified files.  config XML file can specify expiry etc

Dynamically loaded JS files requireJS
Pack and minimize your JavaScript code size

YUI Compressor (from Yahoo)
JSMin (by Douglas Crockford)
ShrinkSafe (from Dojo library)
Packer (by Dean Edwards)

RadScriptManager  & RadStyleSheetManager -fromTeleric(not free)

Tools to optimize performance:

PageSpeed tools family

Posted on Sunday, April 15, 2012 8:08 PM ASP.NET , CSS/DHTML/JavaScript | Back to top

Comments on this post: Select tool to minimize JavaScript and CSS size

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: | Join free