the current problem is that the html
file does not have a version number, and you can see
json
.
rev-manifest.json
{
"cas.css": "cas.css?v=2ddef3cfbd"
}
rev-manifest.json
{
"cas.js": "cas.js?v=a5a6013133"
}
"use strict";
var gulp = require("gulp");
var imagemin = require("gulp-imagemin"); //
var uglify = require("gulp-uglify"); // js
var babel = require("gulp-babel"); // babel
var minifyCss = require("gulp-minify-css"); // css
var minifyHtml = require("gulp-minify-html"); // html
var htmlreplace = require("gulp-html-replace"); // html
var rev = require("gulp-rev"); // gulp
var revCollector = require("gulp-rev-collector"); // gulp
var clean = require("gulp-clean");
// cas-login js
gulp.task("loginJsMin", async function () {
await gulp.src("src/cas-login/cas.js")
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest("dist/cas-login"))
});
// cas-login js
gulp.task("loginJsCopy", async function () {
await gulp.src("src/cas-login/*.min.js")
.pipe(gulp.dest("dist/cas-login"));
});
// cas-login css
gulp.task("loginCssMin", async function () {
await gulp.src("src/cas-login/*.css") // css
.pipe(minifyCss()) //css
.pipe(gulp.dest("dist/cas-login"))
});
// cas-login html
gulp.task("loginHtmlMin", async function () {
await gulp.src("src/cas-login/*.html") // html
.pipe(minifyHtml()) //
.pipe(gulp.dest("dist/cas-login"));
});
// cas-login
gulp.task("loginImagesMin", async function () {
await gulp.src("src/cas-login/images/*")
.pipe(imagemin())
.pipe(gulp.dest("dist/cas-login/images"));
});
// cas-login js hash
gulp.task("loginJsHash", async function () {
await gulp.src("dist/cas-login/cas.js")
.pipe(rev())
.pipe(rev.manifest())
.pipe(gulp.dest("rev/cas-login/js"));
});
// cas-login css hash
gulp.task("loginCssHash", async function () {
await gulp.src("dist/cas-login/*.css") // css
.pipe(rev())
.pipe(rev.manifest())
.pipe(gulp.dest("rev/cas-login/css"));
});
gulp.task("loginRev", function() {
return gulp.src(["rev/cas-login/**/*.json", "dist/cas-login/*.html"])
.pipe(revCollector({
replaceReved: true //,
}))
.pipe(gulp.dest("dist/cas-login"));
});
// Build cas-login
gulp.task("login-build",
gulp.series("loginJsMin", "loginJsCopy", "loginCssMin", "loginImagesMin","loginHtmlMin", "loginJsHash", "loginCssHash", "loginRev", done => {
done();
}));
what I want to solve is that after every gulp after the css,js change, the most recent version number of the html generation can be marked with
.