JavaScript Minification

preview_player
Показать описание
Link for all dot net and sql server video tutorial playlists

Link for slides, code samples and text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

What is JavaScript Minification
JavaScript Minification is the process of reducing the script file size by removing comments, extra whitespaces and new line characters that are not needed for executing JavaScript code. JavaScript Minification may reduce the size of the file by 30 to 90%. The Minification process will not change its original functionality.

What are the benefits of JavaScript Minification
The JavaScript files need to be downloaded to the client machine before the browser can execute your JavaScript code. Since JavaScript Minification reduces the size of the file we have the following benefits
1. Reduced download time
2. Less bandwidth consumption of your website
3. Reduced JavaScript execution time as all the comments, extra whitespaces and new line characters are removed from the minified version
4. Multiple JavaScript files can be compressed into one minified JavaScript file. This means there are now reduced number of HTTP requests to your server, which in turn reduces the load on the server and allows more users to access your website.

What are the disadvantages of JavaScript Minification
Readability is lost and debugging can be difficult as comments, extra whitespaces and new line characters are removed. However, if there is a production issue, use the non-minified version of the script file for debugging. So in production environment use minified version for performance and in development environment use non-minified version for readability and debugging.

JavaScript minification tools
JSMin

Closure Compiler

YUI Compressor

There are also several websites that provide online JavaScript minification. The following is one such website
Рекомендации по теме
Комментарии
Автор

Really very useful and informative. Thanks a lot.

ramchandrathakkar
Автор

thanks sir !! one of the best teacher on youtube !!

hichemhamrouni
Автор

Minification should also rename all user defined variables, functions, objects, etc to 2-character names. That would also go a long way in reducing file size and readability. This shouldn't be hard to implement. The code just checks every word to make sure it's not a javascript keyword. For every non-keyword it finds it replaces it with a 2-character code from a list of all possible key character codes using the 26 letters of the alphabet in lowercase + the 26 letters in uppercase + 10 numeric digits. That gives you over 3, 800 possible unique names. It can then produce a dictionary in the form of a json file that lists the original names replaced along with the corresponding 2-character code. That way you can create a script to search the minified file and replace the 2-character codes with the original names.

caribbeanman
Автор

could you plz do a video on how to auto-minify on Closure compile on a project, ie without copy/paste on website.

mrblacklordz
Автор

Please upload JavaScript slides to your website...Thank you

cutiepieind
welcome to shbcf.ru