summaryrefslogtreecommitdiffstats
path: root/lib/output/assets-inliner.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output/assets-inliner.js')
-rw-r--r--lib/output/assets-inliner.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/output/assets-inliner.js b/lib/output/assets-inliner.js
index 5f33956..65ecbfa 100644
--- a/lib/output/assets-inliner.js
+++ b/lib/output/assets-inliner.js
@@ -22,8 +22,13 @@ AssetsInliner.prototype.onOutputSVG = function(page, svg) {
this.log.debug.ln('output svg from', page.path);
var filename = _.uniqueId('svg_') + '.png';
+ // Convert svg buffer to a png file
return imagesUtil.convertSVGBufferToPNG(svg, this.resolve(filename))
- .thenResolve('/' + filename);
+
+ // Return relative path from the page
+ .thenResolve(function() {
+ return page.relative('/' + filename);
+ });
};
// Output an image as a file
@@ -35,7 +40,11 @@ AssetsInliner.prototype.onOutputImage = function(page, imgFile) {
// Convert SVG to PNG
var filename = _.uniqueId('svg_') + '.png';
return imagesUtil.convertSVGToPNG(page.resolve(imgFile), this.resolve(filename))
- .thenResolve('/' + filename);
+
+ // Return relative path from the page
+ .thenResolve(function() {
+ return page.relative('/' + filename);
+ });
};