Repository navigation
Expand file tree
/
Copy pathastro.config.mjs
More file actions
125 lines (124 loc) · 3.48 KB
/
Copy pathastro.config.mjs
File metadata and controls
125 lines (124 loc) · 3.48 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// @ts-check
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import { indexableSitemap, serializeSitemapItem } from "./src/utils/sitemap";
import { unified } from "@astrojs/markdown-remark";
import tailwindcss from "@tailwindcss/vite";
import remarkToc from "remark-toc";
import remarkCollapse from "remark-collapse";
import { remarkEmbeds } from "./src/utils/remarkEmbeds.mjs";
import { remarkLazyLoadImages } from "./src/utils/remarkLazyLoadImages.mjs";
import { SITE } from "./src/config";
import AstroPWA from "@vite-pwa/astro";
// https://astro.build/config
export default defineConfig({
site: SITE.website,
trailingSlash: "never",
markdown: {
processor: unified({
remarkPlugins: [
remarkToc,
[remarkCollapse, { test: "Table of contents" }],
remarkLazyLoadImages,
remarkEmbeds,
],
}),
shikiConfig: {
// For more themes, visit https://shiki.style/themes
themes: { light: "min-light", dark: "night-owl" },
wrap: true,
},
},
integrations: [
mdx(),
indexableSitemap({
filter: (page) => SITE.showArchives || new URL(page).pathname !== "/archives",
serialize: (item) => serializeSitemapItem(item),
}),
AstroPWA({
registerType: "autoUpdate",
includeAssets: ["favicon.ico", "peter-avatar.jpg"],
manifest: {
name: "Peter Steinberger",
short_name: "steipete",
description:
"AI-powered tools from Swift roots to web frontiers. Everything I build is open source.",
theme_color: "#006cac",
background_color: "#fdfdfd",
display: "standalone",
orientation: "portrait",
scope: "/",
start_url: "/",
icons: [
{
src: "favicon.ico",
sizes: "48x48",
type: "image/x-icon",
},
{
src: "peter-avatar.jpg",
sizes: "192x192",
type: "image/jpeg",
purpose: "any",
},
{
src: "peter-avatar.jpg",
sizes: "512x512",
type: "image/jpeg",
purpose: "any maskable",
},
],
},
workbox: {
navigateFallback: "/404",
globPatterns: ["**/*.{css,js,html,svg,png,jpg,jpeg,gif,webp,woff,woff2,ttf,eot,ico}"],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp)$/,
handler: "CacheFirst",
options: {
cacheName: "images-cache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
},
},
},
],
},
devOptions: {
enabled: true,
suppressWarnings: true,
navigateFallbackAllowlist: [/^\//],
},
experimental: {
directoryAndTrailingSlashHandler: true,
},
}),
],
vite: {
resolve: {
alias: {
"@": "/src",
},
},
plugins: [tailwindcss()],
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
},
});