Patch to PNG generation
This commit is contained in:
parent
04d1aeebd6
commit
630e183d41
2 changed files with 5 additions and 2 deletions
|
|
@ -43,7 +43,8 @@ var packer = new IconPacker({
|
||||||
plugins: [
|
plugins: [
|
||||||
{removeViewBox: false}, // We tend to need this kept around
|
{removeViewBox: false}, // We tend to need this kept around
|
||||||
{removeUselessStrokeAndFill: false}, // Can munge graphics
|
{removeUselessStrokeAndFill: false}, // Can munge graphics
|
||||||
{removeEmptyAttrs: false} // Can be useful to keep around
|
{removeEmptyAttrs: false}, // Can be useful to keep around
|
||||||
|
{removeDimensions: true} // Needed for PNGs to work properly
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
4
index.js
4
index.js
|
|
@ -76,7 +76,8 @@ var IconPacker = function(options) {
|
||||||
plugins: [
|
plugins: [
|
||||||
{removeViewBox: false}, // See note above ---^
|
{removeViewBox: false}, // See note above ---^
|
||||||
{removeUselessStrokeAndFill: false}, // This can clobber some icons, just leave it.
|
{removeUselessStrokeAndFill: false}, // This can clobber some icons, just leave it.
|
||||||
{removeEmptyAttrs: false} // I find this helpful, others may not.
|
{removeEmptyAttrs: false}, // I find this helpful, others may not.
|
||||||
|
{removeDimensions: true}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -376,6 +377,7 @@ IconPacker.prototype.convertSVGtoPNG = function(key, callback) {
|
||||||
xml = '<?xml version="1.0" encoding="utf-8"?>',
|
xml = '<?xml version="1.0" encoding="utf-8"?>',
|
||||||
patch = '<svg width="32" height="32" preserveAspectRatio="xMidYMid meet" ',
|
patch = '<svg width="32" height="32" preserveAspectRatio="xMidYMid meet" ',
|
||||||
svg = new Buffer(xml + this.SVGS[key].data.replace('<svg ', patch));
|
svg = new Buffer(xml + this.SVGS[key].data.replace('<svg ', patch));
|
||||||
|
console.log(svg.toString());
|
||||||
|
|
||||||
// I'll be honest, chaining APIs annoy me - just lemme use an options object.
|
// I'll be honest, chaining APIs annoy me - just lemme use an options object.
|
||||||
im(svg).background(this.opts.png.background).quality(this.opts.png.quality)
|
im(svg).background(this.opts.png.background).quality(this.opts.png.quality)
|
||||||
|
|
|
||||||
Reference in a new issue