-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (42 loc) · 1.11 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
45
46
47
48
49
50
51
52
"use strict";
const gulp = require("gulp");
const babel = require("gulp-babel");
const sass = require("gulp-sass")(require('sass'));
const pug = require("gulp-pug");
sass.compiler = require("node-sass");
// Base Tasks
gulp.task("js", function() {
return gulp
.src("src/js/**/*.js")
.pipe(
babel({
presets: ["@babel/env"]
})
)
.pipe(gulp.dest("public"));
});
gulp.task("sass", function() {
return gulp
.src("src/sass/**/*.sass")
.pipe(sass().on("error", sass.logError))
.pipe(gulp.dest("public"));
});
gulp.task("pug", function() {
return gulp
.src("src/views/pages/*.pug")
.pipe(pug())
.pipe(gulp.dest("./public"));
});
// Gulp Watch
gulp.task("watch:pug", function() {
gulp.watch("src/views/**/*.pug", gulp.series("pug"));
});
gulp.task("watch:sass", function() {
gulp.watch("src/sass/**/*.sass", gulp.series("sass"));
});
gulp.task("watch:js", function() {
gulp.watch("src/js/**/*.js", gulp.series("js"));
});
// Global Tasks
gulp.task("dev", gulp.parallel("watch:pug", "watch:sass", "watch:js"));
gulp.task("build", gulp.series("pug", "sass", "js"));