-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
37 lines (32 loc) · 1.19 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
const del = require("del");
const path = require("path");
const gulp = require("gulp");
const emu = require("gulp-emu");
const rename = require("gulp-rename");
const gls = require("gulp-live-server");
gulp.task("clean", () => del("docs/**/*"));
gulp.task("build", () => gulp
.src(["spec.emu"])
.pipe(emu({
log: require("ecmarkup/lib/utils").logVerbose,
warn: err => {
const file = path.resolve(err.file || "spec.emu");
const message = `Warning: ${file}:${typeof err.line === "number" ? `${err.line}:${err.column}:` : ""} ${err.message}`;
require("ecmarkup/lib/utils").logWarning(message);
},
ecma262Biblio: false,
}))
.pipe(rename("index.html"))
.pipe(gulp.dest("docs")));
gulp.task("watch", () => gulp
.watch(["spec.emu"], gulp.task("build")));
gulp.task("start", gulp.parallel("watch", () => {
const server = gls.static("docs", 8080);
const promise = server.start();
(/** @type {import("chokidar").FSWatcher}*/(gulp.watch(["docs/**/*"])))
.on("change", file => {
server.notify({ path: path.resolve(file) });
});
return promise;
}));
gulp.task("default", gulp.task("build"));