Files
dekun bb4f0c265d Add tablet landscape layout and allow PWA horizontal orientation.
Split mobile and tablet breakpoints, restore desktop-style reading on landscape tablets, and lock Android tablet apps to landscape.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 14:47:50 +08:00

77 lines
1.8 KiB
TypeScript

import { VitePWA } from 'vite-plugin-pwa'
export function createPwaPlugin() {
return VitePWA({
registerType: 'autoUpdate',
injectRegister: null,
manifestFilename: 'site.webmanifest',
includeAssets: [
'favicon.ico',
'favicon.svg',
'favicon.png',
'apple-touch-icon.png',
'icon-192.png',
'icon-512.png',
],
manifest: {
id: '/',
name: '道德经 · 传统文化典籍',
short_name: '道德经',
description: '传统文化典籍资料库',
lang: 'zh-CN',
theme_color: '#0f3460',
background_color: '#1a1a2e',
display: 'standalone',
orientation: 'any',
scope: '/',
start_url: '/',
categories: ['books', 'education'],
icons: [
{
src: '/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png',
purpose: 'any',
},
{
src: '/icon-192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any',
},
{
src: '/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: '/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
globPatterns: [
'assets/**/*.{js,css,woff2}',
'favicon.ico',
'favicon.svg',
'favicon.png',
'icon-192.png',
'icon-512.png',
'apple-touch-icon.png',
'vp-icons.css',
'site.webmanifest',
],
globIgnores: ['**/*.html', 'images/**', 'assets/**/*.png', 'assets/**/*.jpg', 'assets/**/*.webp'],
navigateFallback: null,
cleanupOutdatedCaches: true,
},
devOptions: {
enabled: false,
},
})
}