feat: markdown suport

This commit is contained in:
Anthony Fu committed 2020-12-01 11:36:57 +08:00
1 parent fa4ffd23e7
commit fb069825d6
10 files changed
+169 -90

No files matched your search

+19
View File
@@ -3,6 +3,7 @@ import { UserConfig } from 'vite'
import Voie from 'vite-plugin-voie'
import PurgeIcons from 'vite-plugin-purge-icons'
import ViteComponents from 'vite-plugin-components'
import Markdown from 'vite-plugin-md'
import { VitePWA } from 'vite-plugin-pwa'
const alias = {
@@ -12,6 +13,8 @@ const alias = {
const config: UserConfig = {
alias,
plugins: [
// https://github.com/vamplate/vite-plugin-voie
Voie({
// load index page sync and bundled with the landing page to improve first loading time.
// feel free to remove if you don't need it
@@ -20,13 +23,29 @@ const config: UserConfig = {
return 'sync'
return 'async'
},
extensions: ['vue', 'md'],
}),
// https://github.com/antfu/vite-plugin-md
Markdown(),
// https://github.com/antfu/vite-plugin-components
ViteComponents({
// currently, vite does not provide an API for plugins to get the config https://github.com/vitejs/vite/issues/738
// as the `alias` changes the behavior of middlewares, you have to pass it to ViteComponents to do the resolving
alias,
// allow auto load markdown components under `./src/components/`
extensions: ['vue', 'md'],
// allow auto import and register components used in markdown
customLoaderMatcher: ({ path }) => path.endsWith('.md'),
}),
// https://github.com/antfu/purge-icons
PurgeIcons(),
// https://github.com/antfu/vite-plugin-pwa
VitePWA({
manifest: {
name: 'Vitesse',