mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-26 14:24:05 -06:00
fix(favicon): build on public folder don't created
This commit is contained in:
parent
de227d31fe
commit
d58e13bdb2
@ -1,16 +1,22 @@
|
|||||||
import sharp from "sharp"
|
import sharp from "sharp"
|
||||||
import { joinSegments, QUARTZ, FilePath } from "../../util/path"
|
import { joinSegments, QUARTZ, FullSlug } from "../../util/path"
|
||||||
import { QuartzEmitterPlugin } from "../types"
|
import { QuartzEmitterPlugin } from "../types"
|
||||||
|
import { write } from "./helpers"
|
||||||
|
import { BuildCtx } from "../../util/ctx"
|
||||||
|
|
||||||
export const Favicon: QuartzEmitterPlugin = () => ({
|
export const Favicon: QuartzEmitterPlugin = () => ({
|
||||||
name: "Favicon",
|
name: "Favicon",
|
||||||
async *emit({ argv }) {
|
async *emit({ argv }) {
|
||||||
const iconPath = joinSegments(QUARTZ, "static", "icon.png")
|
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)
|
const faviconContent = sharp(iconPath).resize(48, 48).toFormat("png")
|
||||||
|
|
||||||
yield dest
|
yield write({
|
||||||
|
ctx: { argv } as BuildCtx,
|
||||||
|
slug: "favicon" as FullSlug,
|
||||||
|
ext: ".ico",
|
||||||
|
content: faviconContent,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async *partialEmit() {},
|
async *partialEmit() {},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user