Skip to content

Commit

Permalink
feat(template): add types for theme config (#3122)
Browse files Browse the repository at this point in the history
Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
  • Loading branch information
userquin and brc-dd authored Oct 22, 2023
1 parent 432c548 commit 56b3ce5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions template/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// https://vitepress.dev/guide/custom-theme
<% if (!defaultTheme) { %>import Layout from './Layout.vue'
<% if (!defaultTheme) { %>import Layout from './Layout.vue'<% if (useTs) { %>
import type { Theme } from 'vitepress'<% } %>
import './style.css'

export default {
<% if (!useTs) { %>/** @type {import('vitepress').Theme} */
<% } %>export default {
Layout,
enhanceApp({ app, router, siteData }) {
// ...
}
}
<% } else { %>import { h } from 'vue'
import Theme from 'vitepress/theme'
}<% if (useTs) { %> satisfies Theme<% } %>
<% } else { %>import { h } from 'vue'<% if (useTs) { %>
import type { Theme } from 'vitepress'<% } %>
import DefaultTheme from 'vitepress/theme'
import './style.css'

export default {
extends: Theme,
<% if (!useTs) { %>/** @type {import('vitepress').Theme} */
<% } %>export default {
extends: DefaultTheme,
Layout: () => {
return h(Theme.Layout, null, {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
})
},
enhanceApp({ app, router, siteData }) {
// ...
}
}<% } %>
}<% if (useTs) { %> satisfies Theme<% } %><% } %>

0 comments on commit 56b3ce5

Please sign in to comment.