How to solve the problem with negative values of the viewBox from svg?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
64 views
I make the svg sprite using the plugin gulp-svg-sprites.

Here is a task to create a sprite:
gulp.task('svg-sprite', function (cb) { return gulp.src('src/images/svg-separate/**/*.svg') .pipe(svgSprite({ mode: "symbols", // preview: false, selector: "svg-%f", svg: { symbols: 'svg_sprite.pug' } } )) .pipe(gulp.dest('src/pug/partails/')) });


The problem is that if the svg viewBox is a negative value it after compilation becomes positive and before it is added NaN.

Initial value: viewBox="-49 141 512 512"
After compilation: viewBox="NaN 49 141 512 512"

Icons with a negative value look cropped.
Did someone with such a problem? Any ideas how to fix?
If not, can you recommend any good plugin for svg sprites. Thank you
by | 64 views

2 Answers

0 like 0 dislike
Peresechenie svg below zero it was. Yes it happens when the chandeliers remain.
by
0 like 0 dislike
I always svg icons pre-prepare in the chandelier — bring to uniform size (viewBox), usually 128 or 256 and align the icon inside the area, as well as for fractional pixels. Then save to svg, which perfectly and without glitches Hamouda galpon.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 12, 2019 by serii81
0 like 0 dislike
4 answers
asked Apr 26, 2019 by MDtox
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
36,634 users