-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (29 loc) · 909 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const exec = require("child_process").exec;
const gulp = require("gulp");
const pump = require("pump");
const cleanCSS = require("gulp-clean-css");
const less = require("gulp-less");
const lessFiles = `${__dirname}/src/styles/*.less`;
const excludedLess = `!${__dirname}/src/styles/_*.less`;
const cssDest = `${__dirname}/static/styles`;
async function shrink() {
console.log("** Compiling and minifying .less **");
await pump(
[
gulp.src([ lessFiles, excludedLess ]),
less(),
cleanCSS(),
gulp.dest(cssDest)
],
function(err) {
if (err) {
console.log("--- err:", err);
}
}
);
}
gulp.task("shrink", shrink);
gulp.task("default", gulp.series("shrink", function() {
console.log("--- Starting .less watcher ---");
gulp.watch(lessFiles).on("change", shrink);
}));