Files
ponomar-pwa/vite.config.ts
T
catarrh b4ebd37cc3 fix: unstretched PWA icons, maskable purpose, theme-aware favicon
- generate-icons.py: preserve SVG aspect ratio (was stretched 1.49x), art at 80% for maskable safe zone, emit transparent cross-gold.png
- manifest icons: purpose 'any maskable'
- applyTheme(): compose favicon per app theme (chrome bg + gold cross)
2026-08-22 11:36:14 +03:00

69 lines
2.0 KiB
TypeScript

import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import { resolve } from 'path';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
tailwindcss(),
VitePWA({
registerType: 'autoUpdate',
workbox: {
skipWaiting: true,
clientsClaim: true,
globPatterns: ['**/*.{js,css,html,woff,png}'],
globIgnores: ['**/data/**'],
maximumFileSizeToCacheInBytes: 20 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /\/data\/.*\.json$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'ponomar-data',
expiration: { maxEntries: 200, maxAgeSeconds: 60 * 60 * 24 * 30 },
},
},
{
urlPattern: /\/data\/.*\.text$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'ponomar-bible',
expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 * 30 },
},
},
{
urlPattern: /\/fonts\/.*\.woff2?$/,
handler: 'CacheFirst',
options: {
cacheName: 'ponomar-fonts',
expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 },
},
},
],
},
manifest: {
name: 'Ponomar — Orthodox Calendar',
short_name: 'Ponomar',
description: 'Orthodox Church calendar and liturgical information',
start_url: '/',
display: 'standalone',
background_color: '#f5f0e8',
theme_color: '#1a1a2e',
orientation: 'portrait',
icons: [
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any maskable' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' },
],
},
}),
],
server: {
port: 5173,
strictPort: false,
},
build: {
outDir: 'dist',
sourcemap: true,
},
publicDir: 'static',
});