speisekarten-quartz/quartz/plugins/emitters/favicon.ts
dralagen 9e58857746
feat(favicon): add plugin to expose favicon from icon.png (#1942)
* feat(favicon): add plugin to expose favicon from icon.png

* chore(favicon): clean up formatting and remove unnecessary line breaks
2025-04-26 11:06:59 -07:00

16 lines
493 B
TypeScript

import sharp from "sharp"
import { joinSegments, QUARTZ, FilePath } from "../../util/path"
import { QuartzEmitterPlugin } from "../types"
export const Favicon: QuartzEmitterPlugin = () => ({
name: "Favicon",
async *emit({ argv }) {
const iconPath = joinSegments(QUARTZ, "static", "icon.png")
const dest = joinSegments(argv.output, "favicon.ico") as FilePath
await sharp(iconPath).resize(48, 48).toFormat("png").toFile(dest)
yield dest
},
async *partialEmit() {},
})