diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-22 12:31:02 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-22 12:31:02 +0100 |
commit | 395bd62663614c79181e3e27049345231186339b (patch) | |
tree | 638ffc52ad38918280d481d8af1264c5c3606ac9 /lib/plugins/index.js | |
parent | d8fd6430ed5e15d0dee33f730fb6e8e8346c866a (diff) | |
download | gitbook-395bd62663614c79181e3e27049345231186339b.zip gitbook-395bd62663614c79181e3e27049345231186339b.tar.gz gitbook-395bd62663614c79181e3e27049345231186339b.tar.bz2 |
Provide "plugins" context to theme templates
Diffstat (limited to 'lib/plugins/index.js')
-rw-r--r-- | lib/plugins/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/plugins/index.js b/lib/plugins/index.js index ed3aa0a..bed4488 100644 --- a/lib/plugins/index.js +++ b/lib/plugins/index.js @@ -107,8 +107,17 @@ PluginsManager.prototype.hook = function(name, input) { }; // Extract all resources for a namespace -PluginsManager.prototype.resources = function(namespace) { +PluginsManager.prototype.getResources = function(namespace) { + return Promise.reduce(this.plugins, function(out, plugin) { + return plugin.getResources(namespace) + .then(function(pluginResources) { + _.each(BookPlugin.RESOURCES, function(resourceType) { + out[resourceType] = (out[resourceType] || []).concat(pluginResources[resourceType] || []); + }); + return out; + }); + }, {}); }; // Copy all resources for a plugin |