-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (29 loc) · 863 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 { src, dest, series, watch } = require("gulp");
const del = require("delete");
const sass = require("gulp-sass");
const babel = require("gulp-babel");
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
sass.compiler = require("dart-sass");
function clean(cb) {
return del(["dist/*.css", "dist/*.js"], cb);
}
function sassTask() {
return src(["src/*.scss", "src/*.css"])
.pipe(sass().on("error", sass.logError))
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(dest("dist"));
}
function jsTask() {
return src("src/*.js")
.pipe(
babel({
presets: ["@babel/preset-env"],
})
)
.pipe(dest("dist"));
}
const defaultTask = series(clean, sassTask, jsTask);
watch(["src/*.scss", "src/*.js"], defaultTask);
exports.default = defaultTask;