What is the difference of file js with .min and without .min? [duplicate]

21

What is the JavaScript difference that contains .min (for example jQuery.min.js )
and the file without .min (for example jQuery.js )?

    
asked by Tiago S 18.04.2016 в 16:48
source

2 answers

26

It is very common for libraries (or large files in general) to have a .min , which means minified, compressed.

For example a JavaScript file might look like this:

var jogadores = equipaA + equipaB;

and the minified version looks like this:

var a = b + c;

This is done by a program that compresses JavaScript files and is meant to make the code smaller by decreasing the size of the file, making it lighter to download. In this case, the program can transform this example line up into a shorter line, often with large size differences.

The program generates or changes the variable name so that it gets smaller, but retains the functionality.

In the case of jQuery comparing minified version with undiminished version (also called "developer" or "uncompressed") the difference is clear:

  

Compressed version: 104382 characters
Non-compressed version: 298444 characters (practically 3x)

    
answered by 18.04.2016 / 16:52
source
5

The mined version ( .min ) is the result of a process called minification , which removes unnecessary line breaks, spaces, and comments.

This process does not modify variable names.

The process that modifies the name of the variables is another and is called uglification .

    
answered by 19.04.2016 в 00:38