List and load dependencies.
Based on https://github.com/jackfranklin/gulp-load-plugins.
list (scope, config)
Returns an array of dependency names.
argument | type | default | description |
---|---|---|---|
scope | array | ['dependencies', 'devDependencies', 'peerDependencies'] | list of dependency types |
config | string or object | 'package.json' | path to package.json file or custom config object |
var deps = ldep;var deps = ldep;
load (deps, rename)
Attaches dependency names to a single variable. Dependencies are lazy loaded only when the dependency name is accessed.
argument | type | description |
---|---|---|
deps | array | list of dependency names |
rename | function | function to customize name of each dependency. Takes 2 arguments - name of dependency and camelize function (which converts gulp-plugin to gulpPlugin ) - and returns the modified name |
var deps = ldep;var $ = ldep;// or simplyvar $ = ldep; // now instead of doing thisvar moduleName = ;// use it like this$moduleName // moduleName is loaded now
var $ = ldep { return ;});
like (match, deps)
This is a wrapper for multimatch implemented as multimatch(deps, match)
.
argument | type |
---|---|
match | string or array |
deps | array |
var deps = ldep;// get only gulp pluginsvar gulpPlugins = ldep;// or simplyvar gulpPlugins = ldep;// get only grunt pluginsvar gruntPlugins = ldep;
Usage
npm install ldep
var ldep = ;// load gulp plugins and rename them by removing 'gulp-' prefix and camelizingvar $ = ldep;
// load gulp plugins only from devDependenciesvar $ = ldep;// orvar deps = ldep;var gulpPlugins = ldep; { return ;}var plugins = ldep;