R
R
RodgerFox2016-07-14 22:17:50
gulp.js
RodgerFox, 2016-07-14 22:17:50

Why does svg2png create 400x300 images?

Libraries :

imagemin = require('gulp-imagemin')
+
$ = {
   svgSprite : require('gulp-svg-sprite'),
   svg2png : require('gulp-svg2png')
}

There is a task :
gulp.task('svgSprite', function() {
  return gulp.src('путь до svg/*.svg', {cwd: ''})
    .pipe(cache(imagemin({
            interlaced: true,
            progressive: true,
            optimizationLevel: 3,
            svgoPlugins: [{removeViewBox: false}]
        })))
    .pipe($.svgSprite(configSvg))
      .on('error', function(error) {
        new Elixir.Notification('SVG CRASHED >.<');
      })
    .pipe(gulp.dest('./'))
                .pipe($.svg2png())
    .pipe(gulp.dest('resources/assets/'));
});

Sprite :
<svg fill="#000000" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
    <path clip-rule="evenodd" d="M0 0h24v24H0z" fill="none"/>
    <path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"/>
</svg>

Yes, and any other, always generates 400 by 300.
It turns out a small picture on a large canvas and how to turn these png's into a sprite? (Spanish.gulp.spritesmith produces huge pictures)
I tried to add filter('/**/*.svg) before .pipe($.svg2png()), but there is no difference, because the svg flow is coming. I tried it separately, changed places, I don’t understand anything at all. I thought it was about minification, it's all the same, according to the docks, I can set the sizes of svg2png with handles, but I don't need it. SVGshki have the right size, there are small, there are a little more. What is the problem? The fart is already on fire, everything works except for this heresy.
Thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RodgerFox, 2016-07-14
@RodgerFox

to hell, put https://www.npmjs.com/package/gulp-raster - everything worked =\

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question