This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (38 loc) · 1.48 KB
/
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
37
38
39
40
41
42
43
44
const { gulp, series, parallel, dest, src, watch } = require("gulp");
const postcss = require("gulp-postcss");
const sourcemaps = require("gulp-sourcemaps");
const plumber = require("gulp-plumber");
const gutil = require("gulp-util");
/* -------------------------------------------------------------------------------------------------
Development Tasks
-------------------------------------------------------------------------------------------------- */
function startWatching() {
watch("./src/**/*.css", stylesDev);
}
function stylesDev() {
return src("./src/cherry.css")
.pipe(plumber({ errorHandler: onError }))
.pipe(sourcemaps.init())
.pipe(postcss())
.pipe(dest("./dist"));
}
exports.dev = series(stylesDev, startWatching);
/* -------------------------------------------------------------------------------------------------
Build Tasks
-------------------------------------------------------------------------------------------------- */
function stylesBuild() {
return src("./src/cherry.css")
.pipe(plumber({ errorHandler: onError }))
.pipe(postcss())
.pipe(dest("./dist"));
}
exports.build = series(stylesBuild);
/* -------------------------------------------------------------------------------------------------
Utility Tasks
-------------------------------------------------------------------------------------------------- */
const errorMsg = "\x1b[41mError\x1b[0m";
const onError = (err) => {
gutil.beep();
gutil.log(errorMsg + " " + err.toString());
this.emit("end");
};