1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| import sharp from "sharp"
| import { joinSegments, QUARTZ, FullSlug } from "../../util/path"
| import { QuartzEmitterPlugin } from "../types"
| import { write } from "./helpers"
| import { BuildCtx } from "../../util/ctx"
|
| export const Favicon: QuartzEmitterPlugin = () => ({
| name: "Favicon",
| async *emit({ argv }) {
| const iconPath = joinSegments(QUARTZ, "static", "icon.png")
|
| const faviconContent = sharp(iconPath).resize(48, 48).toFormat("png")
|
| yield write({
| ctx: { argv } as BuildCtx,
| slug: "favicon" as FullSlug,
| ext: ".ico",
| content: faviconContent,
| })
| },
| async *partialEmit() {},
| })
|
|