How do I reduce CSS/HTML/JavaScript footprint in Visual Studio?

Creating SPAs, AJAX enabled apps definitely speeds up web applications. If you want to take performance to next level then you can reduce the CSS/HTML/JavaScript footprint. The smaller files web browser has to download the faster performance will be. If you are using Visual Studio then you can download VS Web Essentials for free. After installation just go to any web project where you have CSS/HTML/JavaScript files. Here’s a sample project:

image

Right click the files and use Minify File. It will generate minified version of these files, provided there’s no syntax error.

image

Just make sure you reference .min version of js and css files.

Magnification happens on the fly. On day to day basis you will still modify regular .css/.html/.js but you will reference and deploy minified version of these files.

In case if you want to stop minifying a file just right click it and select Remove from bundling… option.

When it comes to web site performance size does matter. Good things come in small packages.

fjaved November 13, 2015

Leave a Reply

Your email address will not be published. Required fields are marked *

Web age solutions blog Zones