0
I would like to make the "tasks" below run simultaneously, as I should proceed?
var gulp = require('gulp')
,clean = require('gulp-clean')
,imagemin = require('gulp-imagemin')
,cleanCSS = require('gulp-clean-css')
,minify = require('gulp-minify')
,inlinesource = require('gulp-inline-source')
,htmlmin = require('gulp-htmlmin')
,browserSync = require ('browser-sync');
gulp.task('copy', function(){
return gulp.src('src/**/*')
.pipe(gulp.dest('./dist'));
});
gulp.task('clean',function(){
return gulp.src('./dist')
.pipe(clean());
});
exports.buildImg = () => (
gulp.src('./dist/imagens/**/*.+(png|jpg|gif|jpeg)')
.pipe(imagemin())
.pipe(gulp.dest('./dist/imagens'))
);
gulp.task('minify-css', () => {
return gulp.src('./src/css/**/*.css')
.pipe(cleanCSS())
.pipe(gulp.dest('./dist/css'));
});
gulp.task('minify-js', function(cb) {
gulp.src(['./src/scripts/**/*.js'])
.pipe(minify())
.pipe(gulp.dest('./dist/scripts'))
cb();
});
gulp.task('inline', function () {
return gulp.src('./dist/**/*.html')
.pipe(inlinesource())
.pipe(gulp.dest('./dist'));
});
gulp.task('minify-html', () => {
return gulp.src('src/*.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('./dist'));
});
But why should they run simultaneously? Isn’t it better sequentially? Especially since it seems that some of the processes depend on the previous ones? What I could solve with
gulp.series
orrunSequence
. Already if it were to run simultaneously (q seems to me to be the sense of parallel) would use thegulp.parallel
– Guilherme Nascimento
Yes William, I believe that sequentially it would be ideal, as I should proceed please?
– Munir Baarini
Are you using Gulp 3.9 or Gulp 4.0 (this is very new, I haven’t migrated my projects with Gulp pro 4 yet)? If you do not know type in the terminal or cmd to access the project folder and type
gulp --version
, takes the version of "local Gulp"– Guilherme Nascimento
I was using the 4.0, with the 3.9 everything was beautiful, when I migrated I had some problems,
– Munir Baarini
The
gulp.series()
solves pro 4.0, if it is 3.9 you will have to install runSequence– Guilherme Nascimento