From ce9eedf945529f935e022945d7af3a524f6fe9ad Mon Sep 17 00:00:00 2001 From: David Weber | geOps Date: Mon, 1 Jan 2024 19:46:16 +0100 Subject: [PATCH] fix: dont add styles twice initially happens with the serveAllStyles option The styles will be already be added later by the watcher. This seems to be intoruced with the switch to chokidar in ea89d11021eb6186fdeb3a74f9e367fd6bc99869 Instead we could also add the option ignoreInitial to chokidar Signed-off-by: David Weber | geOps --- src/server.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/server.js b/src/server.js index 2b382a020..fa4b4f252 100644 --- a/src/server.js +++ b/src/server.js @@ -295,21 +295,6 @@ function start(opts) { } if (options.serveAllStyles) { - fs.readdir(options.paths.styles, { withFileTypes: true }, (err, files) => { - if (err) { - return; - } - for (const file of files) { - if (file.isFile() && path.extname(file.name).toLowerCase() == '.json') { - const id = path.basename(file.name, '.json'); - const item = { - style: file.name, - }; - addStyle(id, item, false, false); - } - } - }); - const watcher = chokidar.watch( path.join(options.paths.styles, '*.json'), {},