Ariful Islam
Ariful Islam

Reputation: 3

What is the difference between jquery min js and slim js

Slim version is lighter than the min version. I have tried both but I don't find any difference. Are those same?

Upvotes: 1

Views: 5068

Answers (2)

CertainPerformance
CertainPerformance

Reputation: 370879

jQuery slim, unlike the full jQuery library:

excludes the ajax and effects modules

This exists both in minified and non-minified forms:

https://code.jquery.com/jquery-3.5.1.slim.min.js

https://code.jquery.com/jquery-3.5.1.slim.js

jQuery as a whole can be served either minified, or not minified. It can also be served as the slim version, or as the full version.

Minification is the process by which characters in the script are compressed while keeping the functionality the same. For example, var someLongVariableName can be transformed, via minification, to var c.

So a slim build and a minified build are not the same thing, though they have similar purposes - to reduce the amount of code that needs to be sent over the network.

If you don't need jQuery's ajax and effect modules, use the slim, minified version for production. If you need the ajax or effect modules, don't use the slim version; use the minified full version for production. For development, use an unminified version so that errors inside jQuery are comprehensible.

Upvotes: 2

wasif
wasif

Reputation: 15488

The slim build, which excludes the ajax and effects modules, the small differences between min ans slim.min:

jquery.slim.min.js (compressed / production build)

jquery.slim.js (uncompressed / development build)

Upvotes: 0

Related Questions