What is slim in file.slim.js

Khaled Al-Ansari picture Khaled Al-Ansari · Mar 2, 2016 · Viewed 21.3k times · Source

Excuse my ignorance but I just installed jQuery using npm and between the jQuery files there's a file called jquery.slim.js, what is slim? I know the min stands for minified but slim is new to me!.

btw I'm pretty sure slim is not like min because there's another file called jquery.slim.min.js and obviously it's lighter than the normal slim file.

Also the slim file contains the jQuery 3 beta. (That's what the comments in the code say)

Again sorry for the stupid question but I got no clue.

UPDATE

I'm using require to include the files, would the require include this file without my knowledge? or not?

Answer

Holt picture Holt · Mar 2, 2016

I don't know if .slim.js is a standard name extension for javascript library, but for jQuery, it is a build without some extensions, just check the beginning of the file:

-ajax,-ajax/jsonp,-ajax/load,-ajax/parseJSON,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated

Typically you have no ajax support (jQuery.ajax is not defined), no effects, and the deprecated method are removed.

Concerning requireJS, as far as I know if you require jquery, the only file "included" will be jquery.js, so you would have to explicitely require jquery.slim in order to get jquery.slim.js file included, which is not what you want.