As we have shared earlier how to optimize image (part1) to improve site performance to continue with that topic. I have going to share one more useful topic how to minimize the CSS & JS used in your project.
If you remember Microsoft Ajax minifier (AjaxMinifier) which I have shared earlier in my post we can utilize that tool to
minimize size of the JS & CSS.
So earlier I have explained how to use command prompt to minimize the CSS & JS.
Today I am going to share how to minimize the all the JS & CSS in your project while doing rebuild it.
So here we go just follow below steps.
1) Go to web solution and unload it as show in below fig
<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
<JS Include="**\*.js" Exclude="**\*.min.js;" />
<CSS Include="**\*.css" Exclude="**\*.min.css" />
<AjaxMin JsSourceFiles="@(JS)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".min.js" CssSourceFiles="@(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".min.css" />
Like suppose earlier you have Site.css then now you will find site.min.css also.
So it is clear now.
Now we can use this compress “minimized” CSS or JS file.
In this way we can use minimized CSS & JS improve the website performance.
So enjoy the New Year with fast performance of the site.
Happy New Year
Thanks & Best Regards,