-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
82 lines (81 loc) · 2.18 KB
/
astro.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// @ts-check
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import AstroPWA from "@vite-pwa/astro";
import compress from "astro-compress";
import { defineConfig } from "astro/config";
// https://astro.build/config
export default defineConfig({
integrations: [
react(),
tailwind(),
compress(),
AstroPWA({
// mode: "development",
base: "/",
scope: "/",
includeAssets: ["favicon.svg"],
registerType: "autoUpdate",
manifest: {
name: "Hifz Helper",
short_name: "Hifz Helper",
theme_color: "#ffffff",
icons: [
{
src: "icon192_rounded.png",
sizes: "192x192",
type: "image/png",
},
{
src: "icon512_rounded.png",
sizes: "512x512",
type: "image/png",
},
],
},
workbox: {
runtimeCaching: [
{
urlPattern: /^https:\/\/everyayah.com\/.*$/,
handler: "NetworkFirst", // Uses network but falls back to cache if offline
options: {
cacheName: "audio-cache",
expiration: {
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: "CacheFirst", // Serves from cache first
options: {
cacheName: "image-cache",
expiration: {
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
},
},
},
{
urlPattern: /\.(?:js|css)$/,
handler: "StaleWhileRevalidate", // Uses cached files while fetching updates
options: {
cacheName: "asset-cache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
},
},
},
],
},
devOptions: {
enabled: true,
navigateFallbackAllowlist: [/^\//],
},
experimental: {
directoryAndTrailingSlashHandler: true,
},
}),
],
});