-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathastro.config.ts
56 lines (51 loc) · 1.2 KB
/
astro.config.ts
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
import {defineConfig} from 'astro/config';
import {FontaineTransform} from 'fontaine';
import fs from 'fs';
import path from 'path';
import {buildSprite} from './src/services/images';
const theme = await fetch(
'https://raw.githubusercontent.com/felixgirault/grapes-theme/master/themes/Grapes-color-theme.json'
);
// https://astro.build/config
export default defineConfig({
markdown: {
shikiConfig: {
theme: await theme.json()
}
},
vite: {
plugins: [
FontaineTransform.vite({
fallbacks: ['verdana'],
resolvePath: (id) =>
new URL(`./public${id}`, import.meta.url)
})
]
},
integrations: [
{
name: 'garden',
hooks: {
'astro:config:done': async ({logger}) => {
logger.info('Generating album covers sprite…');
const albumsPath = './src/content/albums';
const spritesPath = './public/sprites';
const paths = fs
.readdirSync(albumsPath)
.filter((file) => file.endsWith('.jpg'))
.map((fileName) =>
path.resolve(albumsPath, fileName)
);
fs.mkdirSync(spritesPath, {
recursive: true
});
await buildSprite(
paths,
64,
path.resolve(spritesPath, 'album-covers.webp')
);
}
}
}
]
});