-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
115 lines (100 loc) · 2.83 KB
/
Copy pathastro.config.mjs
File metadata and controls
115 lines (100 loc) · 2.83 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
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
import path from 'path';
import { fileURLToPath } from 'url';
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import tailwindcss from '@tailwindcss/vite';
import mdx from '@astrojs/mdx';
import partytown from '@astrojs/partytown';
import icon from 'astro-icon';
import compress from '@playform/compress';
import astrowind from './vendor/integration';
import remarkToc from 'remark-toc';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
import { rehypeHeadingIds, unified } from '@astrojs/markdown-remark';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import {
readingTimeRemarkPlugin,
responsiveTablesRehypePlugin,
lazyImagesRehypePlugin,
} from './src/utils/frontmatter.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const hasExternalScripts = false;
const whenExternalScripts = (items = []) =>
hasExternalScripts ? (Array.isArray(items) ? items.map((item) => item()) : [items()]) : [];
export default defineConfig({
output: 'static',
security: {
checkOrigin: true
},
prefetch: true, // Using built-in prefetch
image: {
// Using the default Sharp image service
remotePatterns: [{ protocol: 'https' }],
},
integrations: [
sitemap(),
mdx(),
icon({
include: {
tabler: ['*'],
'flat-color-icons': [
'template',
'gallery',
'approval',
'document',
'advertising',
'currency-exchange',
'voice-presentation',
'business-contact',
'database',
],
},
}),
...whenExternalScripts(() =>
partytown({
config: { forward: ['dataLayer.push'] },
})
),
compress({
// Vite already minifies CSS during the build. Leaving this enabled runs a second
// pass (@playform/compress) that strips Tailwind v4's modern range media queries
// (e.g. `@media (width>=48rem)`), which breaks all responsive breakpoints.
CSS: false,
HTML: {
'html-minifier-terser': {
removeAttributeQuotes: false,
},
},
Image: false,
JavaScript: true,
SVG: false,
Logger: 1,
}),
astrowind({
config: './src/config.yaml',
}),
],
markdown: {
// Applied to .md and .mdx files
processor: unified({
remarkPlugins: [readingTimeRemarkPlugin, [remarkToc, { heading: 'Table of Contents' }]],
rehypePlugins: [
responsiveTablesRehypePlugin,
lazyImagesRehypePlugin,
rehypeHeadingIds,
rehypeAccessibleEmojis,
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'append' }],
],
}),
},
vite: {
plugins: [tailwindcss()],
resolve: {
alias: {
'~': path.resolve(__dirname, './src'),
},
},
},
});