mirror of
https://github.com/vale981/metalsmith-collections
synced 2025-03-04 17:01:41 -05:00
Add Global Options
This commit is contained in:
parent
d30f750ed8
commit
66f79a7555
1 changed files with 11 additions and 1 deletions
12
lib/index.js
12
lib/index.js
|
@ -20,7 +20,7 @@ module.exports = plugin;
|
|||
* @return {Function}
|
||||
*/
|
||||
|
||||
function plugin(opts){
|
||||
function plugin(opts, globalOpts){
|
||||
opts = normalize(opts);
|
||||
var keys = Object.keys(opts);
|
||||
var match = matcher(opts);
|
||||
|
@ -57,6 +57,16 @@ function plugin(opts){
|
|||
metadata[key] = metadata[key] || [];
|
||||
});
|
||||
|
||||
/**
|
||||
* Merge global options with collection options
|
||||
*/
|
||||
|
||||
keys.forEach(function(key){
|
||||
for(var gKey in globalOpts){
|
||||
opts[key][gKey] = opts[key][gKey] || globalOpts[gKey];
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Sort the collections.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue