-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
82 lines (72 loc) · 1.64 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const gulp = require("gulp");
const concat = require("gulp-concat");
const sass = require("gulp-sass");
const gls = require("gulp-live-server");
sass.compiler = require("node-sass");
const DEST = "build";
const JS_DEST = `${DEST}/js`;
gulp.task(
"scripts",
gulp.series(function(done) {
return gulp
.src(["src/js/*.js"])
.pipe(concat("custom.js"))
.pipe(gulp.dest(JS_DEST));
done();
})
);
gulp.task(
"sass",
gulp.series(function(done) {
return gulp
.src("src/scss/*.scss")
.pipe(sass().on("error", sass.logError))
.pipe(gulp.dest("./build/css"));
done();
})
);
gulp.task(
"sass-min",
gulp.series(function(done) {
return gulp
.src("src/scss/*.scss")
.pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
.pipe(gulp.dest("./build/css"));
done();
})
);
gulp.task(
"watch",
gulp.series(function(done) {
gulp.watch("src/scss/*.scss", gulp.series("sass"));
gulp.watch("src/js/*.js", gulp.series("scripts"));
done();
})
);
// Express server
gulp.task(
"serve",
gulp.series(function(done) {
var server = gls.new("src/app.js");
server.start();
// Note: try wrapping in a function if getting an error like `TypeError: Bad argument at TypeError (native) at ChildProcess.spawn`
gulp.watch("src/app.js", function() {
server.start.bind(server)();
});
done();
})
);
// Default Task
// gulp.task('default', ['browser-sync', 'watch'])
gulp.task(
"default",
gulp.series("watch", "serve", function(done) {
done();
})
);
gulp.task(
"install",
gulp.series("scripts", "sass", function(done) {
done();
})
);