Did you notice that Microsoft AJAX library JavaScript files come packaged as release and debug files; e.g. MicrosoftAjax.js and MicrosoftAjax.debug, MicrosoftAjaxWebForms.js and MicrosoftAjaxWebForms.debug.js, etc?


One of the differences is that the release version of the file has no extra spaces, which results in smaller file size, and, consequently, faster download for customers.


There are a couple of tools that come to mind for this purpose:

  1. http://www.cfoster.net/jscrunch/ -- remove spaces in JavaScript code
  2. http://alex.dojotoolkit.org/shrinksafe/ -- in addition to removing spaces and new line characters, this tool renames variables to shorter ones, and uses other techniques to compresses the file.