diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/generate/generator.js | 7 | ||||
-rw-r--r-- | lib/generate/plugin.js | 8 | ||||
-rw-r--r-- | lib/generate/site/index.js | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/generate/generator.js b/lib/generate/generator.js index ad5f8ab..5367b8b 100644 --- a/lib/generate/generator.js +++ b/lib/generate/generator.js @@ -8,6 +8,9 @@ var Plugin = require("./plugin"); var BaseGenerator = function(options) { this.options = options; + // Base for assets in plugins + this.pluginAssetsBase = "book"; + this.options.plugins = Plugin.normalizeNames(this.options.plugins); this.options.plugins = _.union(this.options.plugins, this.options.defaultsPlugins); this.plugins = []; @@ -20,7 +23,9 @@ BaseGenerator.prototype.callHook = function(name, data) { BaseGenerator.prototype.loadPlugins = function() { var that = this; - return Plugin.fromList(this.options.plugins, this.options.input, this) + return Plugin.fromList(this.options.plugins, this.options.input, this, { + assetsBase: this.pluginAssetsBase + }) .then(function(_plugins) { that.plugins = _plugins; diff --git a/lib/generate/plugin.js b/lib/generate/plugin.js index 1e19ed3..e699a26 100644 --- a/lib/generate/plugin.js +++ b/lib/generate/plugin.js @@ -182,7 +182,11 @@ Plugin.normalizeNames = function(names) { }; // Extract data from a list of plugin -Plugin.fromList = function(names, root, generator) { +Plugin.fromList = function(names, root, generator, options) { + options = _.defaults(options || {}, { + assetsBase: "book" + }); + var failed = []; // Load plugins @@ -199,7 +203,7 @@ Plugin.fromList = function(names, root, generator) { // Get resources of plugins return Q.all(_.map(plugins, function(plugin) { - return plugin.getResources(); + return plugin.getResources(options.assetsBase); })) // Extract resources out // css, js, etc ... diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index dc9a4d4..549ad38 100644 --- a/lib/generate/site/index.js +++ b/lib/generate/site/index.js @@ -18,9 +18,6 @@ var Generator = function() { // Attach methods to instance _.bindAll(this); - // Base for assets in plugins - this.pluginAssetsBase = "book"; - this.revision = Date.now(); this.indexer = indexer(); }; |