UseTheme原创
Using a Custom Theme#
You can enable a custom theme by adding the .vitepress/theme/index.js or .vitepress/theme/index.ts file (the "theme entry file").
.
├─ docs
│ ├─ .vitepress
│ │ ├─ theme
│ │ │ └─ index.js
│ │ └─ config.js
│ └─ index.md
└─ package.json
The default export is the only contract for a custom theme. Inside your custom theme, it works just like a normal Vite + Vue 3 application. Do note the theme also needs to be SSR-compatible.
To distribute a theme, simply export the object in your package entry. To consume an external theme, import and re-export it from the custom theme entry:
// .vitepress/theme/index.js
import Theme from 'awesome-vitepress-theme'
export default Theme
上次更新: 2022/08/23, 18:12:45