summaryrefslogtreecommitdiffstats
path: root/lib/models/plugin.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-25 22:30:41 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-25 22:30:41 +0200
commitab2ebefe2bb6dee75e064c1ad572749e3f8104d1 (patch)
treeb6a09abe8726a04a57f69580bad3136dd5d4de60 /lib/models/plugin.js
parentc34a9f6213c204c43c78dd691a5295d7e5a757e8 (diff)
downloadgitbook-ab2ebefe2bb6dee75e064c1ad572749e3f8104d1.zip
gitbook-ab2ebefe2bb6dee75e064c1ad572749e3f8104d1.tar.gz
gitbook-ab2ebefe2bb6dee75e064c1ad572749e3f8104d1.tar.bz2
Copy resources from plugins to output folder
Diffstat (limited to 'lib/models/plugin.js')
-rw-r--r--lib/models/plugin.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/models/plugin.js b/lib/models/plugin.js
index ed7ad82..372558b 100644
--- a/lib/models/plugin.js
+++ b/lib/models/plugin.js
@@ -74,6 +74,23 @@ Plugin.prototype.getHooks = function() {
};
/**
+ Return infos about resources for a specific type
+
+ @param {String} type
+ @return {Map<String:Mixed>}
+*/
+Plugin.prototype.getResources = function(type) {
+ if (type != 'website' && type != 'ebook') {
+ throw new Error('Invalid assets type ' + type);
+ }
+
+ var content = this.getContent();
+ return (content.get(type)
+ || (type == 'website'? content.get('book') : null)
+ || Immutable.Map());
+};
+
+/**
Return map of filters
@return {Map<String:Function>}
*/