forked from badger/badger.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
64 lines (62 loc) · 1.54 KB
/
astro.config.mjs
File metadata and controls
64 lines (62 loc) · 1.54 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
// @ts-check
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import tailwind from '@astrojs/tailwind';
import mdx from '@astrojs/mdx';
import rehypePrettyCode from 'rehype-pretty-code';
const prettyCodeOptions = {
theme: {
dark: 'github-dark-dimmed',
light: 'github-light'
},
keepBackground: false,
onVisitLine(node) {
// Prevent lines from collapsing in `display: grid` mode, and allow empty
// lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{ type: 'text', value: ' ' }];
}
},
onVisitHighlightedLine(node) {
node.properties.className.push('line--highlighted');
},
onVisitHighlightedChars(node) {
node.properties.className = ['chars--highlighted'];
},
};
// https://astro.build/config
export default defineConfig({
integrations: [
react(),
tailwind({
applyBaseStyles: false,
}),
mdx({
rehypePlugins: [
[rehypePrettyCode, prettyCodeOptions]
],
}),
],
site: 'https://badger.github.io',
base: '/',
vite: {
server: {
// Disable caching in dev mode
headers: {
'Cache-Control': 'no-store, no-cache, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
}
},
build: {
// Add content hash to filenames for cache busting
rollupOptions: {
output: {
entryFileNames: 'entry.[hash].js',
chunkFileNames: 'chunks/chunk.[hash].js',
assetFileNames: 'assets/asset.[hash].[ext]'
}
}
}
}
});