Commit c1dc87d4 authored by Philipp Nowinski's avatar Philipp Nowinski

[BUGFIX] fix inlining - those lines were never meant to land in this plugin

parent bcef73d2
...@@ -70,16 +70,10 @@ module.exports = function (_options) { ...@@ -70,16 +70,10 @@ module.exports = function (_options) {
height = result.SVG.ATTR['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$2"); height = result.SVG.ATTR['viewbox'].toString().replace(/^\d+\s\d+\s(\d+\.?[\d])\s(\d+\.?[\d])/, "$2");
} }
var iteration = 0;
var inlineSvg = encodeURIComponent(String(file.contents)).replace(new RegExp('(stroke|fill+)%3D%22%23?((?:.(?!%23?\s+(?:\S+)%3D|[%3E%22]))+.)%22?', 'gim'), function(match, p1, p2) {
return p1 + '%3D%22%23#{color' + ++iteration + '}%22';
});
// store this svg data // store this svg data
svgs.push({ svgs.push({
name: path.basename(file.path, '.svg'), name: path.basename(file.path, '.svg'),
inline: 'data:image/svg+xml,' + inlineSvg, inline: 'data:image/svg+xml,' + encodeURIComponent(String(file.contents)),
width: parseInt(width) + 'px', width: parseInt(width) + 'px',
height: parseInt(height) + 'px' height: parseInt(height) + 'px'
}); });
......
{ {
"name": "gulp-inline-svg", "name": "gulp-inline-svg",
"version": "1.0.2", "version": "1.0.3",
"description": "A gulp plugin to use inline SVG as background-images", "description": "A gulp plugin to use inline SVG as background-images",
"keywords": [ "keywords": [
"gulpplugin, gulp, svg, inline" "gulpplugin, gulp, svg, inline"
......
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