Showing posts with label what is minification. Show all posts
Showing posts with label what is minification. Show all posts

Friday, 30 August 2019

What is minification, uglification and concatenation


Minification:
  • To remove unnecessary whitespace and redundant/optional tokens like semicolons and curlys.
  • Minifying your code speeds up your page loading, making visitors and search engines happy and it is also readable. Most major browsers minify the code before execution.

var myName = 'Sky' 

//Minified version will be - 

var myName='Sky' 

// removed whitespace

Uglification:
  • To convert code in such a format the logic can't be understand easily.
  • It renames the variables and function to hide the original intent.
  • It converts long method name i.e. myLongMethod() to short one i.e a().
  • Once it is used there's no way to reverse it back.

self.myName = 'xyz';

function(self.myName){
console.log(self.myName);
}

// Uglification would be

t.myName = 'xyz';
function(t.myName){console.log(t.myName)}

Concatenation:
  • It Merges all specified files into a single file.