前言
之前我们讲了gulp3.0, 这篇引入gulp4.0, 4.0相比3.0有一些改变的地方:
gulp3.0压缩顺序默认是顺序执行的,4.0引入压缩并行的处理方式:
gulp.series|4.0 依赖顺序执行
gulp.parallel|4.0 多个依赖嵌套'html','css','js'并行
因为之前一步步说了怎么压缩js\ css\image等,此处直接上代码:
gulpfile.js:
const gulp=require('gulp');
const uglify=require('gulp-uglify');
const concat=require('gulp-concat');
const babel=require('gulp-babel');
const sourcemaps=require('gulp-sourcemaps');
const cssmin=require('gulp-cssmin');
const imagemin=require('gulp-imagemin');
const htmlmin = require('gulp-htmlmin');
const connect=require('gulp-connect');
const clean=require('gulp-clean');
const revCollector = require('gulp-rev-collect