Answer the question
In order to leave comments, you need to log in
How to make one task from two tasks in gulp?
Hello.
There are two tasks:
gulp.task('sprites', function () {
return gulp.src(src.source + 'img/svg-files/**/*.svg')
.pipe(svgSprite())
.pipe(gulp.dest(src.source + 'img/svg-sprites/')) // Write the sprite-sheet + CSS + Preview
.pipe(filter(src.source + '/img/svg-files/**/*.svg')) // Filter out everything except the SVG file
});
gulp.task('svg2png', function () {
gulp.src(src.source + 'img/svg-sprites/**/*.svg')
.pipe(svg2png())
.pipe(gulp.dest(src.source + 'img/png-sprites/'));
});
var svgSprite = require("gulp-svg-sprites");
var filter = require('gulp-filter');
var svg2png = require('gulp-svg2png');
gulp.task('sprites', function () {
return gulp.src(src.source + 'img/svg-files/**/*.svg')
.pipe(svgSprite())
.pipe(gulp.dest(src.source + 'img/svg-sprites/')) // Write the sprite-sheet + CSS + Preview
.pipe(filter(src.source + '/img/svg-files/**/*.svg')) // Filter out everything except the SVG file
.pipe(svg2png()) // Create a PNG
.pipe(gulp.dest(src.source + 'img/svg-sprites/png/'));
});
Answer the question
In order to leave comments, you need to log in
so in the stream and without filter only svg files
tryfilter('**/*.svg')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question