Skip to content

Commit b0fc34e

Browse files
committed
fix: Use buffer for memory-fs readFile signature
1 parent ae9a50b commit b0fc34e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/icons-to-woff.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ module.exports = function createIconFont (fs, icons, options) {
4646
}
4747
});
4848
fontStream.write(glyph);
49-
fs.readFile(filename, 'utf-8', function (err, result) {
49+
fs.readFile(filename, function (err, svgBuffer) {
5050
if (err) {
5151
return reject(err);
5252
}
53-
const iconHeight = getSvgHeight(result, filename);
53+
// prevent svgs with fill="none" from beeing translated into an empty symbol
54+
const svgCode = svgBuffer.toString().replace(/\sfill\s*=\s*["']?none['"]?/ig, '')
55+
const iconHeight = getSvgHeight(svgCode, filename);
5456
if (!iconHeight) {
5557
return reject(new Error(`SVG font generation failed as icon "${filename}" does not have a height.`));
5658
}
57-
// prevent svgs with fill="none" from beeing translated into an empty symbol
58-
result = result.replace(/\sfill\s*=\s*["']?none['"]?/ig, '');
59-
glyph.push(result);
59+
glyph.push(svgCode);
6060
glyph.push(null);
6161
});
6262
});

0 commit comments

Comments
 (0)