VitePress
Since VitePress is built using Vuejs 3 and on top of Vite, the integration with this plugin is graceful.
Plugin Configuration
Just follow the Getting Started section and use one of the registerType
option to configure the behavior:
- Prompt for update: prompt for new content refreshing
- Automatic reload when new content available
Import Virtual Modules
You need to configure a custom theme
and use the Layout
component to register the ReloadPrompt.vue
component when using prompt for new content available
, see Vue 3.
You should include the ReloadPrompt.vue
on .vitepress/theme/components/
directory.
You can also integrate Periodic SW updates.
Build
Since VitePress
will generate the pages at the end of the build process, you will need to regenerate the Service Worker of your application when the build process finish (the Service Worker will not have the pages on its precache).
Take a look at build VitePress
site docs:build script.
Vite Plugin PWA Docs Site
You can go to Vite Plugin PWA to see the source code for this site and how it is configured using VitePress
.