Custom builds make it easy to create lightweight versions of lodash containing only the features you need. To top it off, we handle all function dependency & alias mapping for you. Review the build differences & pick the one that’s right for you.
The lodash command-line utility is available when lodash-cli is installed as a global package:
$ {sudo -H} npm i -g npm
$ {sudo -H} npm i -g lodash-cli
$ lodash -h
core modifier.
lodash core
strict modifier.
lodash strict
modularize modifier.
lodash modularize
Build commands:
category command to pass comma separated categories of functions to include in the build.lodash category=collection,function
exports command to pass comma separated names of ways to export the lodash function.lodash exports=amd,node
iife command to specify code to replace the IIFE that wraps lodash.
lodash iife="\!function(window,undefined){%output%}(this)"
include command to pass comma separated names of functions to include in the build.
lodash include=each,filter,map
minus command to pass comma separated function/category names to remove from the build.
lodash minus=result,shuffle
plus command to pass comma separated function/category names to add to the build.
lodash category=array plus=random,template
template command to pass the file path pattern used to match template files to precompile._.templates object.
lodash template="./*.jst"
settings command to pass template settings used when precompiling templates.
lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
moduleId command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.
lodash moduleId=underscore
Notes:
exports values “es” & “npm” may only be used in conjunction with the modularize commandmodularize command uses the first `exports` values as its module format, ignoring subsequent values.-o or --output all files created are saved to the current working directoryThe following options are also supported:
-c, --stdout ................ Write output to standard output-d, --development ..... Write only the non-minified development output-h, --help .................... Display help information-m, --source-map ....... Generate a source map using an optional source map URL-o, --output ................ Write output to a given path/filename-p, --production ....... Write only the minified production output-s, --silent ............... Skip status updates normally logged to the console-V, --version ............. Output current version of lodash