Why use Javascript minifier?
The purpose of minification is to increase the speed of a website, improve your page load performance and reduce network payload sizes. Minimisation can make a script up to 50% smaller, resulting in a faster download time.
JS files are often larger than they should be and often being in the head section of the page code blocking the first paint of your page itself.
Unminified code example:
// My Javascript code
// First function
function codeAddress() {
alert('ok');
}
window.onload = codeAddress;
document.addEventListener('DOMContentLoaded', function() {
alert("Ready!");
}, false);
The code example can be reduced to:
function codeAddress(){alert('ok')}window.onload=codeAddress;document.addEventListener('DOMContentLoaded',function(){alert("Ready!");},false);
From the browser's point of view, these 2 code samples are equivalent, but the minified vesrion uses less bytes. JS Minify can further improve byte efficiency by removing code redoundance, whitespace and comment lines.
Minifying Javascript code increase the performance of your site, increase page speed and download times by making the code easier to read and to interpret.