Minification is the process of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (like newlines or tabs). This improves response time performance because the size of the downloaded file is reduced.
Before publishing your site it is a good idea to minimize your JS and CSS files to reduce network traffic and better performance. In this article I have used YUI compression tool from Yahoo to compress the JS and CSS files. Yahoo compression requires java>=1.4.
In this sample I am using project’s post build event to compress the files and putting them in a folder called Minified from where they are picked up at runtime.
Check out the sample project here.