From 47bddf6ac62b2a4b124baefcfcdbd88c0436a88d Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 27 Apr 2020 17:29:58 -0400 Subject: [PATCH] chore --- README.md | 8 ++------ src/server.ts | 4 +++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3bfdc13d..8e3f6461 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -## Problems to Fix +# (WIP) vitepress 📝💨 -- Should not require vue-router -- Should not require chunk metadata for each page -- Should only inline site metadata that is used in runtime code (detect via proxy created with `useSiteData()`) -- Should use stringified site metadata -- i18n data should be fetched on demand +> [VuePress](http://vuepress.vuejs.org/)' little brother, built on top of [vite](https://github.com/vuejs/vite) diff --git a/src/server.ts b/src/server.ts index db717a81..b9f0ce98 100644 --- a/src/server.ts +++ b/src/server.ts @@ -24,7 +24,9 @@ const VitePressPlugin: Plugin = ({ app, root, watcher, resolver }) => { } }) + // inject Koa middleware app.use(async (ctx, next) => { + // handle .md -> vue transforms if (ctx.path.endsWith('.md')) { const file = resolver.publicToFile(ctx.path) await cachedRead(ctx, file) @@ -35,7 +37,7 @@ const VitePressPlugin: Plugin = ({ app, root, watcher, resolver }) => { return next() } - // detect and serve vitepress files + // detect and serve vitepress @app / @theme files const file = VitePressResolver.publicToFile(ctx.path, root) if (file) { ctx.type = path.extname(file)