-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
144 lines (122 loc) · 3.61 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// @ts-check
// import type { AstroUserConfig } from ' astro/config';
import { defineConfig } from 'astro/config';
import svelte from '@astrojs/svelte';
import starlight from '@astrojs/starlight';
import tailwind from '@astrojs/tailwind';
import starlightBlog from 'starlight-blog';
import compress from '@playform/compress';
//---//
// https://github.com/eslint/eslint/discussions/15305
import packageJSON from './package.json' with { type: 'json' };
const { name, github_pages } = packageJSON;
const isGitHubPagesBuild = !!process.env.GITHUB_PAGES;
const isGitHubPagesPreview = !!process.env.GITHUB_PAGES_PREVIEW;
//---//
// https://astro.build/config
// https://starlight.astro.build/guides/i18n/
// https://starlight.astro.build/reference/configuration/
const baseConfig = {
integrations: [
svelte({ extensions: ['.svelte'] }),
starlight({
disable404Route: true,
defaultLocale: 'en',
locales: {
en: { label: ' English' },
'pt-br': { label: 'Português', lang: 'pt-BR' }
},
/*
title: {
en: 'Docs with Tailwind',
'pt-BR': 'Docs com Tailwind'
},
*/
title: 'Astro Starlight Tailwind',
// https://starlight.astro.build/guides/sidebar/#internationalization
sidebar: [
{
label: 'Guides',
translations: {
'pt-BR': 'Guias'
},
items: [
// Each item here is one entry in the navigation menu.
{
label: 'Example Guide',
translations: {
'pt-BR': 'Guia de Exemplo'
},
slug: 'guides/example'
}
]
},
{
label: 'Reference',
translations: {
'pt-BR': 'Referências'
},
autogenerate: { directory: 'reference' }
}
],
customCss: ['./src/assets/styles/tailwind.css'],
components: {
LanguageSelect:
'./src/components/astro/starlight-overrides/LanguageSelect.astro',
Head: './src/components/astro/starlight-overrides/Head.astro',
Hero: './src/components/astro/starlight-overrides/Hero.astro',
Pagination:
'./src/components/astro/starlight-overrides/Pagination.astro'
},
// https://starlight.astro.build/reference/configuration/#social
social: {
github: 'https://github.com/erkobridee/astro-starlight-hello'
},
// https://starlight.astro.build/reference/configuration/#head
// https://fonts.google.com/specimen/Poppins
head: [
{
tag: 'link',
attrs: {
rel: 'preconnect',
href: 'https://fonts.googleapis.com'
}
},
{
tag: 'link',
attrs: {
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: true
}
},
{
tag: 'link',
attrs: {
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'
}
}
],
plugins: [starlightBlog()]
}),
tailwind({
applyBaseStyles: false,
// Allow writing nested CSS declarations
// alongside Tailwind's syntax
nesting: true
}),
compress()
]
};
//---//
const base = `/${name}`;
export default defineConfig(
isGitHubPagesBuild
? {
...baseConfig,
site: isGitHubPagesPreview ? undefined : github_pages,
base
}
: baseConfig
);