const gulp = require('gulp');
const htmlmin = require('gulp-htmlmin');
const fileinclude = require('gulp-file-include');
const less = require('gulp-less');
const csso = require('gulp-csso');
const babel = require('gulp-babel');
gulp.task('first', () => {console.log('第一次执行');});gulp.task('htmlmin', () => {gulp.src('./src/*.html')//压缩去其中的代码.pipe(fileinclude()).pipe(htmlmin({ collapseWhitespace: true })).pipe(gulp.dest('dist'));
});
gulp.task('cssmin', () => {gulp.src('./src/*.less').pipe(less()).pipe(gulp.dest('dist/css'))});
gulp.task('default', () => {gulp.src('./src/*.js').pipe(babel({presets: ['@babel/env']})).pipe(gulp.dest('dist'))});
运行结果