加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gulpfile.js 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
程欣 提交于 2022-04-05 15:21 . 第一次提交
let gulp = require('gulp');
let cssmin = require('gulp-cssmin');
let autoprefixer = require('gulp-autoprefixer');
let uglify = require('gulp-uglify');
let babel = require('gulp-babel');
let htmlmin = require('gulp-htmlmin');
// let fileInclude = require('gulp-file-include');
let imagemin = require('gulp-imagemin');
function cssHandler() {
return gulp
.src('./src/css/*.css')
.pipe(autoprefixer())
.pipe(cssmin())
.pipe(gulp.dest('./dist/css/'))
}
function jsHandler() {
return gulp
.src('./src/js/*.js')
.pipe(babel({
presets: ['@babel/preset-env']
}))
.pipe(uglify())
.pipe(gulp.dest('./dist/js/'))
}
function htmlHandler() {
return gulp
.src('./src/views/*.html')
.pipe(htmlmin({
removeComments: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
minifyCSS: true,
minifyJS: true,
}))
.pipe(gulp.dest('./dist/views/'))
}
function imageHandler() {
return gulp
.src('./src/images/**.*')
.pipe(imagemin())
.pipe(gulp.dest('./dist/images/'))
}
let _default = gulp.parallel(cssHandler,jsHandler,htmlHandler,)
module.exports = {
cssHandler,
jsHandler,
htmlHandler,
// imageHandler,
_default:_default
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化