There are two common ways that people use to reduce the
When you host your website on a Windows Server using IIS
using GZIP compression – which can provide a significant improvement on
performance and the download size of files. However, you can get additional
Steve Sounders describes these additional benefits in his excellent book High Performance Web Sites.
In addition to releasing Microsoft Ajax Library (Preview 6),
we are today also releasing a new (free) Microsoft Ajax Minifier utility that can help reduce the
who works on the MSN team. You can download the Microsoft Ajax Minifier from the ASP.NET
CodePlex website for free.
The following screenshot demonstrates the results of
minifying the standard jQuery library using various minification tools such as
Douglas Crockford’s JSMin, Dean Edward’s Packer, and the YUI Compressor. The
bottom two files were minified using the Microsoft Ajax Minifier utility. Notice that the Microsoft
Ajax Minifier has reduced jQuery from 125 KB to only 53 KB.
The Microsoft Ajax Minifier supports two levels of
minification: normal and hypercrunched. When you use normal minification, the
Microsoft Ajax Minifier removes all unnecessary whitespace, comments, curly
braces, and semi-colons. When you enable hypercrunching, the Microsoft
file, and it minifies local variable names and removes unreachable code.
minified with the Microsoft Ajax Minifier (with hypercrunching enabled):
Notice that all unnecessary whitespace has been removed. Notice
also that the function parameters firstValue and secondValue have been renamed
to b and a.
The Microsoft Ajax Minifier download includes the following
files in a Visual Studio project.
ajaxmin.dll – A component that you can use in your C# or
After you install the Microsoft Ajax Minifier, you can use
You also have the option of adding the Microsoft Ajax
Minifier as a custom MSBuild task to Visual Studio. Adding the Microsoft Ajax
Minifier MSBuild task to your Visual Studio project file allows you to
perform a build, and enables you to perform minification in an automated way.