Js Minify
Js minify means to compress the js or reduce the size of js .This can be done by removing extra spaces form our code and also comments and extra lines. minifying means does not change the behavior of the program . Minification is the process of removing unnecessary characters from code to reduce its size for improving load times.
Obfuscation is an other alternative of minification that can be used. Like minification it also remove the blank spaces and comments but an additional function is performed by Obfuscation is that it convert s the function and variable name to smaller strings. It reduce the size of code as it harder to read. And harder to reverse into its original form.
Obfuscation reduce the size of javascript to very low But there are chance of bugs or errors with Obfuscation . this can we say this is the disadvantage of Obfuscation .
So I advice to use Minification instead of Obfuscation to prevent the bugs. Because in Minification only the spaces and comments are removed no other variable name wil be changed so no change in the code only size is reduced that will help you to improve the performance of your website
Why its needed ?
It is the need of a good website as it reduce the page loading time . you should always use the minified version of js for your live environment because google check the page loading times so this will also help you in seo or your site traffic. You can check it by download an addon of mozila and check the page loading time with both js minify and unminified then you will find the difference.
You can use jsMin to minify the js
i find a free online tool to minify js.
ReplyDelete