generated from ESBuildTemplates/pixi.ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (31 loc) · 838 Bytes
/
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
const gulp = require("gulp")
const esbuild = require("gulp-esbuild")
const exec = require("child_process").exec
function bundle() {
return gulp
.src("./src/index.ts")
.pipe(
esbuild({
outfile: "bundle.js",
sourcemap: "inline",
bundle: true,
target: ["chrome60", "firefox55", "safari11", "edge18"],
loader: {
".ts": "ts",
".json": "json",
},
})
)
.pipe(gulp.dest("./dist/"))
}
function copyPublic() {
return gulp.src("public/**/*").pipe(gulp.dest("./dist"))
}
function watch() {
exec("reload -b --dir=dist --port=5000", (err) => {
if (err) throw err
})
return gulp.watch("src/**/*.ts", gulp.series(bundle, copyPublic))
}
exports.bundle = gulp.series(bundle, copyPublic)
exports.watch = gulp.series(bundle, copyPublic, watch)