diff options
Diffstat (limited to 'lib/output/folder.js')
-rw-r--r-- | lib/output/folder.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/output/folder.js b/lib/output/folder.js index 96ea443..7e6ddf0 100644 --- a/lib/output/folder.js +++ b/lib/output/folder.js @@ -5,10 +5,11 @@ var path = require('path'); var Output = require('./base'); var fs = require('../utils/fs'); var pathUtil = require('../utils/path'); +var imagesUtil = require('../utils/images'); var Promise = require('../utils/promise'); /* -This output require the native fs module to output +This output requires the native fs module to output book as a directory (mapping assets and pages) */ @@ -25,6 +26,15 @@ FolderOutput.prototype.onAsset = function(filename) { ); }; +// Output a SVG as a file +Output.prototype.onOutputSVG = function(page, svg) { + this.log.debug.ln('output svg from', page.path); + var filename = _.uniqueId('svg_') + '.png'; + + return imagesUtil.convertSVGBufferToPNG(svg, this.resolve(filename)) + .thenResolve('/' + filename); +}; + // Prepare the generation by creating the output folder FolderOutput.prototype.prepare = function() { return fs.mkdirp(this.root()); |