-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.js
40 lines (33 loc) · 778 Bytes
/
start.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
const bs = require("browser-sync").create();
const fs = require("fs-extra");
const {
buildHTML,
buildCSS,
copyStaticAssets,
inputDirectory,
outputDirectory,
} = require("./shared");
async function run() {
await fs.emptyDir(outputDirectory);
await copyStaticAssets();
await buildHTML();
await buildCSS();
bs.watch(`${inputDirectory}/index.html`, async (event) => {
if (event === "change") {
await buildHTML();
}
});
bs.watch(`${outputDirectory}/index.html`).on("change", async () => {
await buildCSS();
bs.reload();
});
bs.watch(`${inputDirectory}/css/styles.css`).on("change", async () => {
await buildCSS();
bs.reload("styles.css");
});
bs.init({
server: outputDirectory,
open: false,
});
}
run();