Gathering detailed insights and metrics for gulp-load-plugins
Gathering detailed insights and metrics for gulp-load-plugins
Gathering detailed insights and metrics for gulp-load-plugins
Gathering detailed insights and metrics for gulp-load-plugins
@types/gulp-load-plugins
TypeScript definitions for gulp-load-plugins
load-plugins
Load plugins for gulp, grunt, assemble, verb any node.js app that needs to load plugins from node_modules or local folders.
@ryancavanaugh/gulp-load-plugins
Type definitions for gulp-load-plugins from https://www.github.com/DefinitelyTyped/DefinitelyTyped
retyped-gulp-load-plugins-tsd-ambient
TypeScript typings for gulp-load-plugins
npm install gulp-load-plugins
Typescript
Module System
Min. Node Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
757 Stars
199 Commits
54 Forks
15 Watchers
5 Branches
28 Contributors
Updated on Jun 01, 2025
Latest Version
2.0.8
Package Id
gulp-load-plugins@2.0.8
Unpacked Size
20.12 kB
Size
7.43 kB
File Count
5
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Loads gulp plugins from package dependencies and attaches them to an object of your choice.
Due to the native support of ES2015 syntax in newer versions of Node, this plugin requires at least Node v8. If you need to maintain support for older versions of Node, version 1.6.0 of this plugin is the last release that will support Node versions less than 8.
NPM:
1$ npm install --save-dev gulp-load-plugins
Yarn:
1$ yarn add -D gulp-load-plugins
Given a package.json
file that has some dependencies within:
1{ 2 "dependencies": { 3 "gulp-jshint": "*", 4 "gulp-concat": "*" 5 } 6}
Adding this into your Gulpfile.js
:
1const gulp = require('gulp'); 2const gulpLoadPlugins = require('gulp-load-plugins'); 3const plugins = gulpLoadPlugins();
Or, even shorter:
1const gulp = require('gulp'); 2const plugins = require('gulp-load-plugins')();
Will result in the following happening (roughly, plugins are lazy loaded but in practice you won't notice any difference):
1plugins.jshint = require('gulp-jshint'); 2plugins.concat = require('gulp-concat');
You can then use the plugins just like you would if you'd manually required them, but referring to them as plugins.name()
, rather than just name()
.
This frees you up from having to manually require each gulp plugin.
You can pass in an object of options that are shown below: (the values for the keys are the defaults):
1gulpLoadPlugins({ 2 DEBUG: false, // when set to true, the plugin will log info to console. Useful for bug reporting and issue debugging 3 pattern: ['gulp-*', 'gulp.*', '@*/gulp{-,.}*'], // the glob(s) to search for 4 overridePattern: true, // When true, overrides the built-in patterns. Otherwise, extends built-in patterns matcher list. 5 config: 'package.json', // where to find the plugins, by default searched up from process.cwd() 6 scope: ['dependencies', 'devDependencies', 'peerDependencies'], // which keys in the config to look within 7 replaceString: /^gulp(-|\.)/, // what to remove from the name of the module when adding it to the context 8 camelize: true, // if true, transforms hyphenated plugins names to camel case 9 lazy: true, // whether the plugins should be lazy loaded on demand 10 rename: {}, // a mapping of plugins to rename 11 renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works) 12 postRequireTransforms: {}, // see documentation below 13 maintainScope: true // toggles loading all npm scopes like non-scoped packages 14});
config
locationsWhile it's possile to grab plugins from another location, often times you may want to extend from another package that enables you to keep your own package.json
free from duplicates, but still add in your own plugins that are needed for your project. Since the config
option accepts an object, you can merge together multiple locations using the lodash.merge package:
1const merge = require('lodash.merge'); 2 3const packages = merge( 4 require('dep/package.json'), 5 require('./package.json') 6); 7 8// Utilities 9const $ = gulpLoadPlugins({ 10 config: packages 11}); 12
postRequireTransforms
(1.3+ only)This enables you to transform the plugin after it has been required by gulp-load-plugins.
For example, one particular plugin (let's say, gulp-foo
), might need you to call a function to configure it before it is used. So you would end up with:
1const $ = require('gulp-load-plugins')(); 2$.foo = $.foo.configure(...);
This is a bit messy. Instead you can pass a postRequireTransforms
object which will enable you to do this:
1const $ = require('gulp-load-plugins')({ 2 postRequireTransforms: { 3 foo: function(foo) { 4 return foo.configure(...); 5 } 6 } 7}); 8 9$.foo // is already configured
Everytime a plugin is loaded, we check to see if a transform is defined, and if so, we call that function, passing in the loaded plugin. Whatever this function returns is then used as the value that's returned by gulp-load-plugins.
For 99% of gulp-plugins you will not need this behaviour, but for the odd plugin it's a nice way of keeping your code cleaner.
From 0.8.0, you can pass in an object of mappings for renaming plugins. For example, imagine you want to load the gulp-ruby-sass
plugin, but want to refer to it as just sass
:
1gulpLoadPlugins({
2 rename: {
3 'gulp-ruby-sass': 'sass'
4 }
5});
Note that if you specify the renameFn
options with your own custom rename function, while the rename
option will still work, the replaceString
and camelize
options will be ignored.
gulp-load-plugins
comes with npm scope support. By default, the scoped plugins are accessible through an object on plugins
that represents the scope. When maintainScope = false
, the plugins are available in the top level just like any other non-scoped plugins.
Note: maintainScope
is only available in Version 1.4.0 and up.
For example, if the plugin is @myco/gulp-test-plugin
then you can access the plugin as shown in the following example:
1const scoped = require('gulp-load-plugins')({ 2 // true is the default value 3 maintainScope: true, 4}); 5 6scoped.myco.testPlugin(); 7 8const nonScoped = require('gulp-load-plugins')({ 9 maintainScope: false, 10}); 11 12nonScoped.testPlugin();
In 0.4.0 and prior, lazy loading used to only work with plugins that return a function. In newer versions though, lazy loading should work for any plugin. If you have a problem related to this please try disabling lazy loading and see if that fixes it. Feel free to open an issue on this repo too.
In 1.4.0 and prior, configuring the pattern
option would override the built-in ['gulp-*', 'gulp.*', '@*/gulp{-,.}*']
. If overridePattern: false
, the configured pattern
will now extends the built-in matching.
For example, both are equivilant statements.
1const overridePlugins = require('gulp-load-plugins')({ 2 // true is the default value 3 overridePattern: true, 4 pattern: ['gulp-*', 'gulp.*', '@*/gulp{-,.}*', 'foo-bar'] 5}); 6 7const extendedPlugins = require('gulp-load-plugins')({ 8 overridePattern: false, 9 pattern: ['foo-bar'] 10});
Credit largely goes to @sindresorhus for his load-grunt-plugins plugin. This plugin is almost identical, just tweaked slightly to work with Gulp and to expose the required plugins.
overridePattern
- thanks @bretkikehara - PRmaintainScope
- thanks @bretkikehara - PRpostRequireTransforms
- thanks @vinitm - PRrequire
function - PR - thanks @mwessnerreplaceString
has been removed - thanks @carloshpdsDEBUG
option to turn on logging and help us debug issues - thanks @dcamillerirenameFn
function to give users complete control over the name a plugin should be given when loaded - thanks @callumacraeNODE_PATH
is no longer supported. It was causing complexities and in the PR that droppped support no one shouted that they required NODE_PATH
support.require
to look on the NODE_PATH
if it can't find the module in the working directory. PR - thanks @chmaniepackage.json
file but the wrong node_modules
directory - thanks @callumacraefiles
property to package.json so only required files are downloaded when installed - thanks @shinnngulp.spritesmith
- thanks to @MRuycamelize
option on by defaultcamelize
option, thanks @kombucha.gulp-load-plugins
.package.json
(thanks @ben-eb).gulpLoadplugins
returning an object with the tasks define.replaceString
option to configure exactly what gets replace when the plugin adds the module to the contextNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More