Is there some API similar with onAfterConfigResolve
or buildStart
in vitepress
#4593
Closed
shellRaining
started this conversation in
General
Replies: 1 comment 6 replies
-
You can do that with vite plugin: // .vitepress/config.ts
import { defineConfig, type SiteConfig } from 'vitepress'
export default defineConfig({
vite: [
{
name: 'foo',
configResolved(config) {
const siteConfig = ((config as any).vitepress as SiteConfig)
// do stuff
}
}
]
}) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/shellRaining/shellRaining-blog/blob/2a2222f579557de8e7065552a79adc57cb29c637/packages/theme/src/node/config.ts#L62-L64
I am building a custom theme for a VitePress blog, and I want users to be able to specify a font when using it, my theme will perform font subsetting during the build process
After the font subsetting operation, a piece of CSS code for font-face is generated. I wish to insert it into the final built HTML, but the buildEnd hook function is too late, and it seems below code not work
I check the code of vitepress and found the
onAfterConfigResolve
hook in thenode/cli/ts
, but it seems to be used internally by vitepress and I cannot invoke it. Therefore, I would like to ask if there are other methods to address this issue.Beta Was this translation helpful? Give feedback.
All reactions