Skip to content

Commit fe435ae

Browse files
canduxacalcutt
authored andcommitted
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 ea89d11 Instead we could also add the option ignoreInitial to chokidar Signed-off-by: David Weber | geOps <[email protected]>
1 parent 26d8066 commit fe435ae

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/server.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -295,21 +295,6 @@ function start(opts) {
295295
}
296296

297297
if (options.serveAllStyles) {
298-
fs.readdir(options.paths.styles, { withFileTypes: true }, (err, files) => {
299-
if (err) {
300-
return;
301-
}
302-
for (const file of files) {
303-
if (file.isFile() && path.extname(file.name).toLowerCase() == '.json') {
304-
const id = path.basename(file.name, '.json');
305-
const item = {
306-
style: file.name,
307-
};
308-
addStyle(id, item, false, false);
309-
}
310-
}
311-
});
312-
313298
const watcher = chokidar.watch(
314299
path.join(options.paths.styles, '*.json'),
315300
{},

0 commit comments

Comments
 (0)