-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
68 lines (56 loc) · 1.65 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
const Promise = require("bluebird");
const path = require("path");
const gulp = require("gulp");
const gulpNamedLog = require("gulp-named-log");
const gulpRename = require("gulp-rename");
const gulpNodemon = require("gulp-nodemon");
const gulpCached = require("gulp-cached");
const presetSCSS = require("@joepie91/gulp-preset-scss");
const awaitServer = require("await-server");
const gulpLivereload = require("gulp-livereload");
const patchLivereloadLogger = require("@joepie91/gulp-partial-patch-livereload-logger");
patchLivereloadLogger(gulpLivereload);
let config = {
scss: {
source: "./scss/**/*.scss",
destination: "./public/css/"
},
cssModules: []
}
let serverLogger = gulpNamedLog("server");
gulp.task("nodemon", ["scss", "livereload"], () => {
gulpNodemon({
script: "app.js",
ignore: [
"gulpfile.js",
"node_modules",
"public"
],
ext: "js html json"
}).on("start", () => {
Promise.try(() => {
serverLogger.info("Starting...");
return awaitServer(3000);
}).then(() => {
serverLogger.info("Started!");
gulpLivereload.changed("*");
});
});
});
gulp.task("scss", () => {
return gulp.src(config.scss.source)
.pipe(presetSCSS({
livereload: gulpLivereload
}))
.pipe(gulp.dest(config.scss.destination));
});
gulp.task("livereload", () => {
gulpLivereload.listen({
quiet: true
});
});
gulp.task("watch-css", () => {
gulp.watch(config.scss.source, ["scss"]);
});
gulp.task("watch", ["nodemon", "watch-css"]);
gulp.task("default", ["watch"]);