pull/1/head
Evan You 5 years ago
parent 1209e7cc00
commit 47bddf6ac6

@ -1,7 +1,3 @@
## Problems to Fix # (WIP) vitepress 📝💨
- Should not require vue-router > [VuePress](http://vuepress.vuejs.org/)' little brother, built on top of [vite](https://github.com/vuejs/vite)
- 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

@ -24,7 +24,9 @@ const VitePressPlugin: Plugin = ({ app, root, watcher, resolver }) => {
} }
}) })
// inject Koa middleware
app.use(async (ctx, next) => { app.use(async (ctx, next) => {
// handle .md -> vue transforms
if (ctx.path.endsWith('.md')) { if (ctx.path.endsWith('.md')) {
const file = resolver.publicToFile(ctx.path) const file = resolver.publicToFile(ctx.path)
await cachedRead(ctx, file) await cachedRead(ctx, file)
@ -35,7 +37,7 @@ const VitePressPlugin: Plugin = ({ app, root, watcher, resolver }) => {
return next() return next()
} }
// detect and serve vitepress files // detect and serve vitepress @app / @theme files
const file = VitePressResolver.publicToFile(ctx.path, root) const file = VitePressResolver.publicToFile(ctx.path, root)
if (file) { if (file) {
ctx.type = path.extname(file) ctx.type = path.extname(file)

Loading…
Cancel
Save