-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
77 lines (72 loc) · 1.78 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
import { readFileSync } from 'node:fs';
import sitemap from '@astrojs/sitemap';
import astroPWA, { type PwaOptions } from '@vite-pwa/astro';
import astroIcon from 'astro-icon';
import { defineConfig } from 'astro/config';
import { assetsCache, externalResourcesCache, pagesCache, scriptsCache } from './src/sw-caching.ts';
const manifest: PwaOptions['manifest'] = JSON.parse(readFileSync('./src/manifest.json', { encoding: 'utf8' }));
const mode = process.env['NODE_ENV'] === 'production' ? 'production' : 'development';
export default defineConfig({
site: 'https://blog.torontojs.com/',
base: '/',
trailingSlash: 'ignore',
compressHTML: true,
build: {
format: 'directory'
},
server: {
host: 'localhost',
port: 3000
},
...(mode !== 'production' && {
vite: {
server: {
https: {
cert: './certs/server.crt',
key: './certs/server.key'
}
}
}
}),
markdown: {
syntaxHighlight: 'shiki',
shikiConfig: {
theme: 'css-variables',
themes: {
light: 'light-plus',
dark: 'dark-plus'
},
wrap: true
}
},
integrations: [
astroPWA({
registerType: 'prompt',
minify: true,
includeAssets: ['/icons/icon.svg'],
manifest,
workbox: {
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
maximumFileSizeToCacheInBytes: 1024 * 128,
cleanupOutdatedCaches: true,
clientsClaim: true,
skipWaiting: false,
navigateFallback: '/offline',
navigateFallbackDenylist: [/\.(?:png|gif|jpg|jpeg|webp|svg|ico)$/iu],
directoryIndex: 'index.html',
runtimeCaching: [externalResourcesCache, assetsCache, scriptsCache, pagesCache]
},
devOptions: {
enabled: false
}
}),
sitemap({
changefreq: 'weekly',
priority: 0.7,
lastmod: new Date()
}),
astroIcon({
iconDir: 'src/assets/icons'
})
]
});