forked from rot1024/astrotion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
46 lines (38 loc) · 1.13 KB
/
astro.config.mjs
File metadata and controls
46 lines (38 loc) · 1.13 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
import sitemap from "@astrojs/sitemap";
import { defineConfig } from "astro/config";
import robotsTxt from "astro-robots-txt";
import { BASE_PATH, CUSTOM_DOMAIN } from "./src/constants";
import astrotion from "./src/integrations";
import tailwindcss from "@tailwindcss/vite";
// https://astro.build/config
export default defineConfig({
site: getSite(),
base: BASE_PATH,
integrations: [astrotion(), sitemap(), robotsTxt()],
vite: {
optimizeDeps: { exclude: ["@resvg/resvg-js"] },
plugins: [tailwindcss()]
},
trailingSlash: "always",
});
function getSite() {
if (CUSTOM_DOMAIN) {
return new URL(BASE_PATH, `https://${CUSTOM_DOMAIN}`).toString();
}
if (process.env.VERCEL && process.env.VERCEL_URL) {
return new URL(BASE_PATH, `https://${process.env.VERCEL_URL}`).toString();
}
if (process.env.CF_PAGES) {
if (process.env.CF_PAGES_BRANCH !== "main") {
return new URL(BASE_PATH, process.env.CF_PAGES_URL).toString();
}
return new URL(
BASE_PATH,
`https://${new URL(process.env.CF_PAGES_URL).host
.split(".")
.slice(1)
.join(".")}`,
).toString();
}
return;
}