Skip to content

Commit 078a914

Browse files
committed
update
1 parent cbb872d commit 078a914

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.vitepress/config.mts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,98 @@
11
// import flexSearchIndexOptions from "flexsearch";
2+
import { VitePWA } from 'vite-plugin-pwa';
23
import { defineConfig } from 'vitepress';
34
import environmentNav from './nav/environment.mts';
45
import { environment } from './sidebar/main.mts';
56

67
export default defineConfig({
8+
vite: {
9+
plugins: [
10+
// VitePWA 配置区
11+
// - 官方中文手册:https://vite-pwa-org-zh.netlify.app/
12+
// - 这里使用 vite 通用包
13+
// - 你也可以使用 vitepress 框架包(@vite-pwa/vitepress)
14+
VitePWA({
15+
injectRegister: 'auto',
16+
registerType: 'autoUpdate',
17+
base: '/',
18+
scope: '/',
19+
includeAssets: ['static/**/*.{ico,png,jpg,svg}'],
20+
devOptions: {
21+
enabled: true,
22+
suppressWarnings: true,
23+
navigateFallback: '/',
24+
type: 'module',
25+
},
26+
workbox: {
27+
globPatterns: ['**/*.{js,css,html,ico,png,jpg,jpeg,gif,svg,woff2}'],
28+
cleanupOutdatedCaches: true,
29+
sourcemap: true,
30+
skipWaiting: true,
31+
clientsClaim: true,
32+
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
33+
runtimeCaching: [
34+
{
35+
urlPattern: /\.(?:mp4)$/,
36+
handler: 'CacheFirst',
37+
options: {
38+
cacheName: 'media-cache',
39+
expiration: {
40+
maxEntries: 300,
41+
maxAgeSeconds: 60 * 60 * 24 * 365,
42+
},
43+
},
44+
},
45+
{
46+
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
47+
handler: 'CacheFirst',
48+
options: {
49+
cacheName: 'images-cache',
50+
expiration: {
51+
maxEntries: 30,
52+
maxAgeSeconds: 60 * 60 * 24 * 30,
53+
},
54+
},
55+
},
56+
],
57+
},
58+
manifest: {
59+
short_name: 'PHP 环境搭建',
60+
name: 'PHP 环境搭建',
61+
icons: [
62+
{
63+
src: '/static/logo.png',
64+
sizes: '192x192',
65+
type: 'image/png',
66+
},
67+
{
68+
src: '/static/logo.png',
69+
sizes: '512x512',
70+
type: 'image/png',
71+
},
72+
{
73+
src: '/static/logo.png',
74+
sizes: '512x512',
75+
type: 'image/png',
76+
purpose: 'any',
77+
},
78+
{
79+
src: '/static/logo.png',
80+
sizes: '512x512',
81+
type: 'image/png',
82+
purpose: 'maskable',
83+
},
84+
],
85+
description: '纯手工搭建一个完善的PHP环境',
86+
theme_color: '#ffffff',
87+
background_color: '#ffffff',
88+
display: 'standalone',
89+
orientation: 'any',
90+
start_url: '/',
91+
scope: '/',
92+
},
93+
}),
94+
],
95+
},
796
base: '/',
897
ignoreDeadLinks: false, // 当设置为 true 时,VitePress 不会因为死链而导致构建失败。
998
// 部分 markdown 文件不作为源内容输出的,需要排除

0 commit comments

Comments
 (0)