代码拉取完成,页面将自动刷新
const gulp = require("gulp");
const htmlmin = require("gulp-htmlmin");
const htmlclean = require("gulp-htmlclean");
const version = require("gulp-version-number");
const terser = require("gulp-terser");
// Compress js files
gulp.task("js", function () {
return gulp
.src(["./public/js/main.js"])
.pipe(
terser({
compress: true,
}),
)
.pipe(gulp.dest("./public/js"));
});
// Build html files
gulp.task("html", function () {
return gulp
.src("./public/**/*.html")
.pipe(htmlclean())
.pipe(
htmlmin({
removeComments: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
}),
)
.pipe(
version({
append: {
key: "_v",
cover: 1,
to: ["css", "js", "png", "jpg", "woff2"],
},
}),
)
.pipe(gulp.dest("./public"));
});
gulp.task("default", gulp.parallel("js", "html"));
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。