-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathgulpfile.js
More file actions
35 lines (29 loc) · 906 Bytes
/
gulpfile.js
File metadata and controls
35 lines (29 loc) · 906 Bytes
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
import autoprefixer from "autoprefixer";
import { deleteAsync as del } from "del";
import gulp from "gulp";
import postcss from "gulp-postcss";
import sass from "gulp-sass";
import env from "postcss-preset-env";
import * as dartSass from "sass";
const sassCompiler = sass(dartSass);
gulp.task("clean", () => {
return del(["dist/css/"]);
});
gulp.task("sass", () => {
return gulp
.src("src/sass/**/*.scss")
.pipe(sassCompiler().on("error", sassCompiler.logError))
.pipe(gulp.dest("dist/css/"));
});
gulp.task("postcss", () => {
const plugins = [env(), autoprefixer()];
return gulp.src("dist/css/*.css").pipe(postcss(plugins)).pipe(gulp.dest("dist/css/"));
});
gulp.task("default", gulp.series(["clean", "sass", "postcss"]));
gulp.task("watch", () => {
return gulp.watch(
"src/sass/*.scss",
{ ignoreInitial: false },
gulp.series(["clean", "sass", "postcss"])
);
});