mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
19 lines
571 B
TypeScript
19 lines
571 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, cfg }) {
|
|
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() {},
|
|
}) |