E
E
Evgeniy2021-06-13 22:57:27
css
Evgeniy, 2021-06-13 22:57:27

Why is the width of the icon larger than the actual size?

Hello everyone
I'm building on grids, collecting in gulp, scss
for images, no styles are set,
all icons are collected in a sprite via gulp-svg-sprite

task in gulpfile

gulp.task('svgSprite', function () {
  return gulp.src([source_folder + '/iconsprite/*.svg'])
    .pipe(svgSprite({
      mode: {
        stack: {
          sprite: "../icons/icons.svg",  //sprite file name
          example: true
        }
      },
    }
    ))
    .pipe(dest(path.build.img))
})



in the svg code of the image, everything is written correctly like:
svg width="42" height="42" viewBox="0 0 42 42"

why is the width of the icon larger than the actual one?
as if there are some fields on the sides
how to make it become actual ???


when I set the exact height and width to "auto", the margins remain
when I set the exact width and height to "auto", the image shrinks
when I set exactly this and that, it shrinks even more

60c662dd740f7064546914.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy, 2021-06-14
@Zheleznov

In general, how to fix, I did not find the answer.
When gulp-svg-sprite is disabled, everything is fine, so it's in it
Just replaced gulp-svg-sprite with gulp-svgstore
Now the sizes are fixed
I'll leave it here, maybe it will help someone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question