Skip to content

Commit 5f49d5f

Browse files
zslabsjackfranklin
authored andcommitted
Add documentation for accepting multiple config locations (#125)
* Add documentation for accepting multiple config locations As discussed in #124 * Switch to var to match docs * Use extend npm package * add lodash.merge * Update README.md * Update README.md
1 parent 41b2da4 commit 5f49d5f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ gulpLoadPlugins({
7171
});
7272
```
7373

74+
## Multiple `config` locations
75+
76+
While 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](https://www.npmjs.com/package/lodash.merge) package:
77+
78+
```js
79+
var merge = require('lodash.merge');
80+
81+
var packages = merge(
82+
require('dep/package.json'),
83+
require('./package.json')
84+
);
85+
86+
// Utilities
87+
var $ = gulpLoadPlugins({
88+
config: packages
89+
});
90+
91+
```
92+
7493
## `postRequireTransforms` (1.3+ only)
7594

7695
This enables you to transform the plugin after it has been required by gulp-load-plugins.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"Dorian Camilleri",
3434
"Carlos Henrique",
3535
"iamfrontender <[email protected]>",
36-
"Brian Woodward"
36+
"Brian Woodward",
37+
"Zach Schnackel <[email protected]>"
3738
],
3839
"dependencies": {
3940
"array-unique": "^0.2.1",

0 commit comments

Comments
 (0)