Commit 4df2eefd authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[BUGFIX] fix buffer/string conversions

parent 9dad1050
...@@ -45,7 +45,7 @@ module.exports = class InlineSvg { ...@@ -45,7 +45,7 @@ module.exports = class InlineSvg {
}); });
svgs.forEach(svg => this._processSvg(svg)) svgs.forEach(svg => this._processSvg(svg))
let template = mustache.render( let template = mustache.render(
templateContent, templateContent.toString(),
_.extend( _.extend(
{}, {},
this._options.context, this._options.context,
...@@ -102,8 +102,8 @@ module.exports = class InlineSvg { ...@@ -102,8 +102,8 @@ module.exports = class InlineSvg {
width = parseInt(xmlString.svg.$['width']); width = parseInt(xmlString.svg.$['width']);
height = parseInt(xmlString.svg.$['height']); height = parseInt(xmlString.svg.$['height']);
} else { } else {
width = parseInt(result.svg.$['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$1")); width = parseInt(xmlString.svg.$['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$1"));
height = parseInt(result.svg.$['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$2")); height = parseInt(xmlString.svg.$['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$2"));
} }
return { return {
width, width,
...@@ -138,7 +138,7 @@ module.exports = class InlineSvg { ...@@ -138,7 +138,7 @@ module.exports = class InlineSvg {
* @returns {String} * @returns {String}
*/ */
_getTemplateContent() { _getTemplateContent() {
return fs.readFileSync(this._options.template, 'utf-8'); return fs.readFileSync(this._options.template);
} }
}; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment