-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (35 loc) · 1.12 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
var gulp = require("gulp");
var exec = require("child_process").exec;
var execSync = require("child_process").execSync;
var livereload = require("gulp-livereload");
var gulpif = require("gulp-if");
var uglify = require("gulp-uglify");
var IS_PRODUCTION = process.env.NODE_ENV == "production";
gulp.task("rebuild_texts", function() {
execSync("node validate.js");
});
gulp.task("validate", function() {
livereload.listen();
gulp.watch("validate.js", ["rebuild_texts"]);
gulp.watch("text.yml", ["rebuild_texts"]);
});
gulp.task("javascripts", function() {
return gulp
.src("assets/javascripts/*.js")
.pipe(gulpif(IS_PRODUCTION, uglify()))
.pipe(gulp.dest("public/assets/javascripts"))
.pipe(livereload());
});
gulp.task("watch", function() {
livereload.listen();
gulp.watch("assets/javascripts/*.js", gulp.series("javascripts"));
});
gulp.task("server", function(cb) {
exec("node server", function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task("compile", gulp.series("javascripts"));
gulp.task("serve", gulp.parallel("compile", "server", "watch"));