1
0
mirror of https://github.com/jdan/98.css.git synced 2026-05-05 06:01:22 +09:00

add chokidar and npm start

This commit is contained in:
Jordan Scales
2020-04-25 19:47:53 -04:00
parent a302f52636
commit 9b4cb16669
5 changed files with 249 additions and 9 deletions

26
server.js Normal file
View File

@@ -0,0 +1,26 @@
const chokidar = require("chokidar");
const handler = require("serve-handler");
const http = require("http");
const build = require("./build");
chokidar
.watch(["style.css", "build.js", "docs", "fonts", "icon"], {
usePolling: true,
})
.on("change", (file) => {
console.log(
`[${new Date().toLocaleTimeString()}] ${file} changed -- rebuilding...`
);
build();
});
const server = http.createServer((request, response) => {
return handler(request, response, {
public: "dist",
});
});
server.listen(3000, () => {
console.log("Running at http://localhost:3000");
});