-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (55 loc) · 1.47 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
var gulp = require("gulp");
var clean = require("gulp-clean");
var shell = require("gulp-shell");
/**
* Cleans out the ./dist/ subfolder for the frest build.
*/
gulp.task("clean", () => {
return gulp
.src("dist/*", { read: false })
.pipe(clean());
});
/**
* Copies the "website" files needed to make the game run.
*/
gulp.task("copy-www", function () {
return gulp
.src(["./www/**/*"])
.pipe(gulp.dest("./dist/"));
});
/**
* Cleans out the ./dist/ subfolder for the frest build.
*/
gulp.task("copy-game-assets", () => {
return gulp
.src(["assets/**/*"])
.pipe(gulp.dest("dist/assets/"));
});
/**
* Compiles the source code into JS into the ./dist/ folder.
*/
gulp.task("compile",
shell.task("webpack --config webpack.config.js")
);
/**
* Compiles the source code into JS into the ./dist/ folder.
*/
gulp.task("compile-development",
shell.task("webpack --config dev-webpack.config.js")
);
/**
* The default gulp task when run without a task argument.
* Builds the game into the output ./dist/ directory.
*/
gulp.task("default", gulp.series(
gulp.task("clean"),
gulp.parallel("copy-game-assets", "copy-www", "compile")
));
/**
* Alternative build mode that uses the development mode of webpack for building.
* Builds the game into the output ./dist/ directory.
*/
gulp.task("development", gulp.series(
gulp.task("clean"),
gulp.parallel("copy-game-assets", "copy-www", "compile-development")
));