diff --git a/public/icons/icon-192.png b/public/icons/icon-192.png new file mode 100644 index 0000000..2542f79 Binary files /dev/null and b/public/icons/icon-192.png differ diff --git a/public/icons/icon-512.png b/public/icons/icon-512.png new file mode 100644 index 0000000..2542f79 Binary files /dev/null and b/public/icons/icon-512.png differ diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest new file mode 100644 index 0000000..350fe4a --- /dev/null +++ b/public/manifest.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Lernschiff", + "short_name": "Lernschiff", + "description": "Kinderlernplattform für 3–14 Jahre", + "start_url": "/", + "display": "standalone", + "background_color": "#f0eee9", + "theme_color": "#f0eee9", + "lang": "de", + "icons": [ + { + "src": "/icons/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/icons/icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/vite.config.js b/vite.config.js index 00c43ac..9e1bbd4 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,7 @@ import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import tailwindcss from '@tailwindcss/vite'; +import { VitePWA } from 'vite-plugin-pwa'; export default defineConfig({ plugins: [ @@ -9,5 +10,28 @@ export default defineConfig({ input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/auth.js'], refresh: true, }), + VitePWA({ + registerType: 'autoUpdate', + manifest: false, + workbox: { + runtimeCaching: [ + { + urlPattern: /\.(?:js|css|woff2?|png|svg|ico)$/i, + handler: 'CacheFirst', + options: { + cacheName: 'assets-cache', + expiration: { + maxEntries: 100, + maxAgeSeconds: 60 * 60 * 24 * 30, + }, + }, + }, + { + urlPattern: /^https?:\/\/.+\/(?!api)/, + handler: 'NetworkOnly', + }, + ], + }, + }), ], });