-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
76 lines (75 loc) · 2.11 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
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import cloudflare from "@astrojs/cloudflare";
import Icons from "unplugin-icons/vite";
import tunnel from "astro-tunnel";
import sitemap from "@astrojs/sitemap";
import {
i18n,
filterSitemapByDefaultLocale,
type UserI18nConfig,
} from "astro-i18n-aut/integration";
import { remarkModifiedTime, remarkTimeRead } from "./remark-plugins";
import pageInsight from "astro-page-insight";
const vesper = async () => {
const response = await fetch(
"https://raw.githubusercontent.com/raunofreiberg/vesper/main/themes/Vesper-dark-color-theme.json"
);
const text = await response.text();
const sanitizedText = text.replace(
/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g,
(match, group) => (group ? "" : match)
);
return JSON.parse(sanitizedText);
};
const i18nConfig: UserI18nConfig = {
defaultLocale: "en",
locales: {
en: "en-UK",
nl: "nl-NL",
},
exclude: ["pages/open-graph/**/*", "pages/api/**/*"],
};
// https://astro.build/config
export default defineConfig({
integrations: [
i18n(i18nConfig),
sitemap({
i18n: i18nConfig,
filter: filterSitemapByDefaultLocale({
defaultLocale: i18nConfig.defaultLocale,
}),
}),
tailwind(),
tunnel(),
pageInsight(),
],
vite: {
plugins: [
Icons({
compiler: "astro",
autoInstall: true,
}),
],
},
site: import.meta.env.CF_PAGES_URL || "https://nilsbeerten.nl",
trailingSlash: "never",
build: {
format: "file",
},
output: "hybrid",
adapter: cloudflare({
imageService: "passthrough",
runtime: {
mode: "off",
},
}),
markdown: {
// @ts-expect-error Types for plugins are incorrect, wants `() => {}` but needs `() => () => {}`
remarkPlugins: [remarkModifiedTime, remarkTimeRead],
shikiConfig: {
theme: await vesper(),
wrap: true,
},
},
});