-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (34 loc) · 1.09 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
var gulp = require("gulp");
var connect = require("gulp-connect");
var watch = require("gulp-watch");
var tsc = require("gulp-tsc");
var notify = require("gulp-notify");
gulp.task("webserver", function () {
connect.server({
root: ["build"],
livereload: true
});
});
gulp.task("livereload", function () {
gulp.src(["build/*.js", "root/**/*.*"])
.pipe(watch())
.pipe(connect.reload());
});
gulp.task("root", function () {
gulp.src(["root/**/*"], { base: 'root'}).pipe(gulp.dest("build"));
gulp.src(["lib/**/*"], { base: 'lib'}).pipe(gulp.dest("build"));
});
gulp.task("compile", function () {
return gulp.src(["src/Main.ts"])
.pipe(tsc({
out: "game.js",
emitError: true
}))
.on("error", notify.onError({ message: "Error: <%= error.message %>", title: "Typescript Error"}))
.pipe(gulp.dest("build"));
});
gulp.task("watch", function () {
gulp.watch("src/**/*.ts", ["compile"]);
gulp.watch("root/**/*.*", ["root"]);
});
gulp.task("default", ["root", "compile", "webserver", "livereload", "watch"]);