-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
69 lines (65 loc) · 1.94 KB
/
astro.config.mjs
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
// TODO: Fix footnotes because apparently linkify doesnt discriminate
import { defineConfig } from "astro/config";
import vercel from "@astrojs/vercel/static";
// Markdown plugins
import { rehypeHeadingIds } from "@astrojs/markdown-remark";
import linkify from "rehype-autolink-headings";
import rehypeAttrs from "./plugins/rehype-attrs";
import rehypeExternalLinks from "./plugins/rehype-external-links";
import rehypeUnwrapImages from "./plugins/rehype-unwrap-images";
import remarkModifiedTime from "./plugins/remark-modified-time";
// Astro plugins
import tailwind from "@astrojs/tailwind";
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import mdx from "@astrojs/mdx";
import expressiveCode from "astro-expressive-code";
const VERCEL_PREVIEW_SITE =
process.env.VERCEL_ENV !== "production" &&
process.env.VERCEL_URL &&
`https://${process.env.VERCEL_URL}`;
console.log("[VERCEL_PREVIEW_SITE]", VERCEL_PREVIEW_SITE);
// https://astro.build/config
export default defineConfig({
site: VERCEL_PREVIEW_SITE || "https://blog.samtheq.com",
scopedStyleStrategy: "class",
server: ({ command }) => ({ port: command === "dev" ? 5665 : 6116 }),
markdown: {
gfm: true,
remarkPlugins: [remarkModifiedTime],
rehypePlugins: [
rehypeAttrs,
rehypeHeadingIds,
[linkify, { behavior: "wrap" }],
rehypeExternalLinks,
rehypeUnwrapImages,
],
},
integrations: [
tailwind({
applyBaseStyles: false,
}),
react(),
expressiveCode({
themes: ["dark-plus"],
// frames: false,
styleOverrides: {
codeFontFamily: "Fira Code VF",
codeLineHeight: 1.5,
uiFontFamily: "Inter var",
uiLineHeight: 1.5,
codeFontSize: "14px",
// codeFontSize: "0.875rem",
},
}),
mdx(),
sitemap(),
],
// wants to be serverless by default
output: "static",
adapter: vercel({
webAnalytics: {
enabled: true,
},
}),
});