mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
18 lines
469 B
TypeScript
18 lines
469 B
TypeScript
![]() |
import chokidar from "chokidar";
|
||
|
import fs from "fs";
|
||
|
import path from "path";
|
||
|
|
||
|
const emptyCallback = () => {};
|
||
|
|
||
|
function onFileChanged(sourceFile: string) {
|
||
|
const destFile = path.join("dist", sourceFile);
|
||
|
console.log(`${sourceFile} -> ${destFile}`);
|
||
|
fs.copyFile(sourceFile, destFile, emptyCallback);
|
||
|
}
|
||
|
|
||
|
const sourceDir = "src/public";
|
||
|
|
||
|
chokidar
|
||
|
.watch(sourceDir)
|
||
|
.on("change", onFileChanged);
|
||
|
console.log(`Watching for changes to ${sourceDir}...`);
|