diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-20 02:04:15 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-20 02:04:15 +0200 |
commit | 878c105def7ee73648a79019311730a662c11144 (patch) | |
tree | 83fe542865cfe80ae95579274147b04a049b8d7a /lib/generate/plugin.js | |
parent | 74d628676b3d5a49b0f461261ba39c6839557410 (diff) | |
download | gitbook-878c105def7ee73648a79019311730a662c11144.zip gitbook-878c105def7ee73648a79019311730a662c11144.tar.gz gitbook-878c105def7ee73648a79019311730a662c11144.tar.bz2 |
Use complete assets folder for plugins
Diffstat (limited to 'lib/generate/plugin.js')
-rw-r--r-- | lib/generate/plugin.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/generate/plugin.js b/lib/generate/plugin.js index 77bbee5..d1becd4 100644 --- a/lib/generate/plugin.js +++ b/lib/generate/plugin.js @@ -2,7 +2,6 @@ var _ = require("lodash"); var Q = require("q"); var semver = require("semver"); var path = require("path"); -var crc = require('crc'); var fs = require("./fs"); var pkg = require("../../package.json"); @@ -44,8 +43,7 @@ Plugin.prototype.getResources = function(resource) { return _.chain(this.infos.book[resource]) .map(function(resource) { return { - "path": this.resolveFile(resource), - "id": crc.hex32(crc.crc32(resource)) + "path": this.name+"/"+resource } }.bind(this)) .value(); @@ -80,6 +78,18 @@ Plugin.prototype.callHook = function(name, args) { }); }; +// Copy plugin assets fodler +Plugin.prototype.copyAssets = function(out) { + if (!this.infos.book || !this.infos.book.assets) return Q(); + return fs.copy( + this.resolveFile(this.infos.book.assets), + out + ); +}; + + + + // Normalize a list of plugin name to use Plugin.normalizeNames = function(names) { // Normalize list to an array |