Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Toolchain
inline-svg
Commits
4df2eefd
Commit
4df2eefd
authored
Sep 18, 2018
by
Philipp Nowinski
Browse files
[BUGFIX] fix buffer/string conversions
parent
9dad1050
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
index.js
index.js
+4
-4
No files found.
index.js
View file @
4df2eefd
...
@@ -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
);
}
}
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment