if you want to add a version to the project, the json that is replaced with gulp-rev generation is always generated only two corresponding css
/
function getDistFolder(distPath) {
return `${distFolder}/${distPath}`;
}
// -----------
// LESS
// -----------
// LESS
function compileLess(input, base, output, watch, min, sourcemaps) {
return gulp.src(input, {base: base})
.pipe($.plumber())
.pipe(watch ? $.watch(input, {base: base}) : noop())
.pipe(watch || !!argv.using ? $.using({prefix: "Using less"}) : noop())
.pipe(sourcemaps ? $.sourcemaps.init() : noop())
.pipe($.less())
.pipe(min ? $.cleanCss() : noop())
.pipe(sourcemaps ? $.sourcemaps.write() : noop())
.pipe($.rev())
.pipe(gulp.dest(output))
.pipe($.rev.manifest())
.pipe(gulp.dest(output))
}
function compRev(output, distPath) {
return gulp.src([output + "/*.json", distPath + "/**/**/*.html"])
.pipe(revCollector({
replaceReved: true
}))
.pipe(gulp.dest(distPath));
}
gulp.task("admin:rev", function () {
log("");
return compRev(getDistFolder("admin/css"), getDistFolder("admin"));
});
gulp.task("school:rev", function () {
return compRev(getDistFolder("school/css"), getDistFolder("school"));
});
gulp.task("oss:rev", function () {
return compRev(getDistFolder("oss/css"), getDistFolder("oss"));
});
// bootstrap
gulp.task("less:bootstrap:admin", () => {
return compileLess(resetPath(src.less.bootstrap, "admin"), "", getDistFolder("admin/css"), false, !!argv.min, !!argv.sourcemaps);
});
gulp.task("less:bootstrap:school", () => {
return compileLess(resetPath(src.less.bootstrap, "school"), "", getDistFolder("school/css"), false, !!argv.min, !!argv.sourcemaps);
});
gulp.task("less:bootstrap:oss", () => {
return compileLess(resetPath(src.less.bootstrap, "oss"), "", getDistFolder("oss/css"), false, !!argv.min, !!argv.sourcemaps);
});
// bootstrap
gulp.task("watch:bootstrap:admin", () => {
gulp.watch(resetPath(src.less.bootstrapWatch, "admin"), ["less:bootstrap:admin"]);
});
gulp.task("watch:bootstrap:school", () => {
gulp.watch(resetPath(src.less.bootstrapWatch, "school"), ["less:bootstrap:school"]);
});
gulp.task("watch:bootstrap:oss", () => {
gulp.watch(resetPath(src.less.bootstrapWatch, "oss"), ["less:bootstrap:oss"]);
});
// app.css
gulp.task("less:common:admin", () => {
return compileLess(resetPath(src.less.common, "admin"), "", getDistFolder("admin/css"), false, !!argv.min, !!argv.sourcemaps);
});
gulp.task("less:common:school", () => {
return compileLess(resetPath(src.less.common, "school"), "", getDistFolder("school/css"), false, !!argv.min, !!argv.sourcemaps);
});
gulp.task("less:common:oss", () => {
return compileLess(resetPath(src.less.common, "oss"), "", getDistFolder("oss/css"), false, !!argv.min, !!argv.sourcemaps);
});
Project path