Skip to content

Commit 0b1ee63

Browse files
author
Bret Ikehara
committed
document the npm scoped config option
1 parent 9526346 commit 0b1ee63

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ gulpLoadPlugins({
6767
lazy: true, // whether the plugins should be lazy loaded on demand
6868
rename: {}, // a mapping of plugins to rename
6969
renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works)
70-
postRequireTransforms: {} // see documentation below
70+
postRequireTransforms: {}, // see documentation below
71+
scoped: true // loads all npm scopes like non-scoped packages
7172
});
7273
```
7374

@@ -136,12 +137,22 @@ Note that if you specify the `renameFn` options with your own custom rename func
136137

137138
## npm Scopes
138139

139-
`gulp-load-plugins` comes with [npm scope](https://docs.npmjs.com/misc/scope) support. The major difference is that scoped plugins are accessible through an object on `plugins` that represents the scope. For example, if the plugin is `@myco/gulp-test-plugin` then you can access the plugin as shown in the following example:
140+
`gulp-load-plugins` comes with [npm scope](https://docs.npmjs.com/misc/scope) support. By default, the scoped plugins are accessible through an object on `plugins` that represents the scope. When `scoped = false`, the plugins are availble in the top level just like any other non-scoped plugins.
141+
142+
For example, if the plugin is `@myco/gulp-test-plugin` then you can access the plugin as shown in the following example:
140143

141144
```js
142-
var plugins = require('gulp-load-plugins')();
145+
var scoped = require('gulp-load-plugins')({
146+
scoped: true,
147+
});
148+
149+
scoped.myco.testPlugin();
150+
151+
var nonScoped = require('gulp-load-plugins')({
152+
scoped: false,
153+
});
143154

144-
plugins.myco.testPlugin();
155+
nonScoped.testPlugin();
145156
```
146157

147158
## Lazy Loading

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"Carlos Henrique",
3535
"iamfrontender <iamfrontender@gmail.com>",
3636
"Brian Woodward",
37-
"Zach Schnackel <info@zslabs.com>"
37+
"Zach Schnackel <info@zslabs.com>",
38+
"Bret K. Ikehara <bret.k.ikehara@gmail.com>"
3839
],
3940
"dependencies": {
4041
"array-unique": "^0.2.1",

0 commit comments

Comments
 (0)