Microsoft Ajax Minifier NuGet Command

Share:
The Microsoft Ajax Minifier enables you to improve the performance of your web applications by reducing the size of your Cascading Style Sheet and JavaScript files.

In Visual Studio Go to  Tools >> NuGet Package Manager >> Package Manager Console and run the below command. It will install the latest Package available.

PM> Install-Package AjaxMin

Nuget URL: https://www.nuget.org/packages/AjaxMin

JavaScript and CSS files minified with Ajax Minifier should work same as without minification.

If your file doesn’t work after minification,
First check to see if your JavaScript code contains eval statements that might require you to use a different –evals switch.

Example:- 

Before Minification
var a= 1;
if(a==5)
{
alert(5);
}
else if(a==1)
{
alert(1)
}

After Minification
var a=1;a==5?alert(5):a==1&&alert(1)

When using Minification, Try to avoid the following : 

  • Global Variables and Functions
  • Using Eval() Function 
  • With Statement

Hi! I am Sartaj Husain. I am a Professional Software Developer, live in Delhi. I write blogs in my free time. I love to learn and share the knowledge with others because it is no good to try to stop knowledge from going forward. So free posts and tutorials. more..

No comments