-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathastro.config.mjs
More file actions
84 lines (76 loc) · 1.87 KB
/
astro.config.mjs
File metadata and controls
84 lines (76 loc) · 1.87 KB
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
83
84
// @ts-check
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import svelte from '@astrojs/svelte';
import sitemap from '@astrojs/sitemap';
import AstroPWA from '@vite-pwa/astro';
const prodBranch = 'prod';
const prodSite = 'https://covers.roler.dev';
const previewSite = process.env.CF_PAGES_BRANCH
? `https://${process.env.CF_PAGES_BRANCH}.bbc-frontend.pages.dev`
: null;
const currentTime = new Date();
// https://astro.build/config
export default defineConfig({
vite: {
plugins: [tailwindcss()],
},
site:
!process.env.CF_PAGES_BRANCH || process.env.CF_PAGES_BRANCH === prodBranch
? prodSite
: previewSite || prodSite,
integrations: [
svelte(),
sitemap({
serialize(item) {
const itemURL = new URL(item.url);
// @ts-ignore
item.lastmod = currentTime;
// @ts-ignore
item.changefreq = 'daily';
item.priority = 0.5;
if (itemURL.pathname === '/') {
// @ts-ignore
item.changefreq = 'monthly';
item.priority = 1.0;
} else {
// @ts-ignore
item.changefreq = 'weekly';
item.priority = 0.7;
}
return item;
},
}),
AstroPWA({
mode: import.meta.env.DEV ? 'development' : 'production',
base: '/',
scope: '/',
includeAssets: ['favicon.svg'],
registerType: 'prompt',
manifest: {
name: 'Big Book Covers',
short_name: 'BBC',
theme_color: '#04262e',
background_color: '#030d11',
},
pwaAssets: {
config: true,
},
workbox: {
navigateFallback: '/404',
navigateFallbackDenylist: [/sitemap.*\.xml$/, /robots\.txt$/],
globPatterns: ['**/*.{css,js,html,svg,png,ico,txt}'],
ignoreURLParametersMatching: [/.*/],
},
devOptions: {
enabled: false,
navigateFallbackAllowlist: [/^\/.*/],
},
experimental: {
directoryAndTrailingSlashHandler: true,
},
}),
],
prefetch: true,
output: 'static',
});