1。定义gulp插件
var gulp = require("gulp"),
cssmin = require("gulp-cssmin"),
revAll = require("gulp-rev-all"),
revCollector = require('gulp-rev-collector'),
2。这是我的大任务CSS任务
gulp.task("css", function () {
return gulp.src('assets/css/**/*.css')
.pipe(cssmin())
.pipe(revAll.revision())
.pipe(gulp.dest('dist/assets/css'))
.pipe(revAll.manifestFile())
.pipe(gulp.dest('dist/manifest'))
});
3。在html文件中替换gulp新的CSS名称
gulp.task("updateRefrence", function () {
return gulp.src(["dist/manifest/rev-manifest.json", "./login.html"])
.pipe(revCollector({
replaceReved: true
}))
.pipe(gulp.dest("./dist/"))
});