-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
33 lines (26 loc) · 950 Bytes
/
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
// https://docs.astro.build/en/reference/configuration-reference/
import mdx from '@astrojs/mdx';
import { defineConfig } from 'astro/config';
// https://tailwindcss.com/docs/installation/framework-guides/astro
import tailwindcss from '@tailwindcss/vite';
import packageJSON from './package.json' assert { type: 'json' };
const { name, github_pages } = packageJSON;
const isGitHubPagesBuild = !!process.env.GITHUB_PAGES;
const isGitHubPagesPreview = !!process.env.GITHUB_PAGES_PREVIEW;
/** @type {import('astro/config').config} */
const baseConfig = {
integrations: [mdx()],
vite: {
plugins: [tailwindcss()]
}
};
// https://docs.astro.build/en/guides/deploy/github/#configure-astro-for-github-pages
const config = isGitHubPagesBuild
? {
...baseConfig,
site: isGitHubPagesPreview ? undefined : github_pages,
base: `/${name}`
}
: baseConfig;
// https://astro.build/config
export default defineConfig(config);