Skip to content

Commit

Permalink
fix: dont add styles twice initially
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
candux authored and acalcutt committed Jan 27, 2024
1 parent 26d8066 commit fe435ae
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
{},
Expand Down

0 comments on commit fe435ae

Please sign in to comment.