When I was at DrupalCon Denver I suggested that all production JavaScript should be minified. This seemed like something simple that I wouldn't get any push back on. After all, the major JavaScript packages do it and the performance recommendation tools all recommend it. I was wrong. Over the past couple weeks I've received push back from numerous people who've told that me if you use gzip (or deflate) compression there's no need to minify JavaScript. So, here is a case for minifying JavaScript.

There are a lot of programs that will minify your Javascript code for free – all you have to do is simply google “Javascript minifier”, and these sites will simply ask you to submit your Javascript code and will return the minified result.

In the ENGINEEREDWEB[dot]COM blog "why minify javascript?" have a very good clarification about JavaScript minify;

1. drupal.js and jquery.once.js are smaller minified than compressed with gzip. Because of these two files have lots of fantastic documentation in them. When a file is minified this is stripped out as it's not needed for functionality.

2. Good for saving total bandwidth of your website through the saving of the website's total files size.

Minification in Javascript is the process of removing all characters that are not necessary from the Javascript source code. That is why it is called “minification” – because all of the data that is not necessary to the functioning of the Javascript is removed from the source code, and therefore the Javascript is “minimized”. Even though these characters are removed from the Javascript source code, the functionality of the Javascript code does not change at all. So, your Javascript code will behave exactly the same even after it goes through the minification process. Code that has gone through the minification process is also known as “minified” code.