UNPKG
wge-cli
Version:
latest (0.0.1)
0.0.1
Live server for the Wagon templating engine!
github.com/str1z/wge-cli
str1z/wge-cli
wge-cli
/
lib
/
watch.js
13 lines
(10 loc)
•
302 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
const
fs =
require
(
"fs"
);
const
path =
require
(
"path"
);
function
watch
(
dir, handler
) {
for
(
let
item
of
fs.
readdirSync
(dir)) {
let
full = path.
resolve
(dir, item);
if
(fs.
statSync
(full).
isDirectory
())
watch
(full, handler); } fs.
watch
(dir, handler); }
module
.
exports
= watch;