From 739eb6340318a22f9d0325afca4999f5d32bfd55 Mon Sep 17 00:00:00 2001 From: Wei Yen Lee Date: Sat, 9 Nov 2024 15:57:07 +1100 Subject: [PATCH] Reload dev server on articles change --- app/lib/vite-plugin-articles.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/lib/vite-plugin-articles.ts b/app/lib/vite-plugin-articles.ts index 86f26ff..78a5a08 100644 --- a/app/lib/vite-plugin-articles.ts +++ b/app/lib/vite-plugin-articles.ts @@ -55,6 +55,16 @@ export function articlesPlugin(): Plugin { 'app/articles.json', JSON.stringify(sortedArticles, null, 2) ) + }, + configureServer(server) { + // Watch for changes to markdown files + server.watcher.add('articles/*.md') + server.watcher.on('change', (file) => { + if (file.endsWith('.md')) { + // Trigger rebuild when markdown files change + server.restart() + } + }) } } } \ No newline at end of file