Add PWA install support for mobile and desktop

Register service worker, install prompt UI, iOS meta tags, and document install steps in DEPLOY.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-05 17:41:51 +08:00
parent a8be586652
commit f663867a25
11 changed files with 4923 additions and 39 deletions
+5 -1
View File
@@ -1,6 +1,7 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitepress'
import { createPwaPlugin } from './pwa.mts'
import { missingAssetsPlugin } from './missing-assets-plugin.mjs'
import { generateRewrites } from './rewrites.mts'
import { generateSidebar } from './sidebar.mts'
@@ -37,6 +38,9 @@ export default defineConfig({
['meta', { name: 'msapplication-TileImage', content: '/apple-touch-icon.png' }],
['meta', { name: 'apple-mobile-web-app-title', content: '道德经' }],
['meta', { name: 'application-name', content: '道德经' }],
['meta', { name: 'mobile-web-app-capable', content: 'yes' }],
['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }],
],
themeConfig: {
logo: { src: '/favicon.ico', width: 24, height: 24 },
@@ -54,7 +58,7 @@ export default defineConfig({
},
},
vite: {
plugins: [missingAssetsPlugin()],
plugins: [missingAssetsPlugin(), createPwaPlugin()],
server: {
host: '0.0.0.0',
},