From c538c151c7462ad0395ff2c15c5e11e89e362aa8 Mon Sep 17 00:00:00 2001
From: Striven <sg.striven@cutecat.club>
Date: Sat, 04 Apr 2026 19:47:16 +0000
Subject: [PATCH] Initial commit
---
quartz/plugins/emitters/static.ts | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/quartz/plugins/emitters/static.ts b/quartz/plugins/emitters/static.ts
index 043a461..0b45290 100644
--- a/quartz/plugins/emitters/static.ts
+++ b/quartz/plugins/emitters/static.ts
@@ -1,18 +1,23 @@
-import { FilePath, QUARTZ, joinSegments } from "../../path"
+import { FilePath, QUARTZ, joinSegments } from "../../util/path"
import { QuartzEmitterPlugin } from "../types"
-import path from "path"
import fs from "fs"
-import { glob } from "../../glob"
+import { glob } from "../../util/glob"
+import { dirname } from "path"
export const Static: QuartzEmitterPlugin = () => ({
name: "Static",
- getQuartzComponents() {
- return []
- },
- async emit({ argv, cfg }, _content, _resources, _emit): Promise<FilePath[]> {
- const staticPath = path.join(QUARTZ, "static")
+ async *emit({ argv, cfg }) {
+ const staticPath = joinSegments(QUARTZ, "static")
const fps = await glob("**", staticPath, cfg.configuration.ignorePatterns)
- await fs.promises.cp(staticPath, joinSegments(argv.output, "static"), { recursive: true })
- return fps.map((fp) => joinSegments("static", fp)) as FilePath[]
+ const outputStaticPath = joinSegments(argv.output, "static")
+ await fs.promises.mkdir(outputStaticPath, { recursive: true })
+ for (const fp of fps) {
+ const src = joinSegments(staticPath, fp) as FilePath
+ const dest = joinSegments(outputStaticPath, fp) as FilePath
+ await fs.promises.mkdir(dirname(dest), { recursive: true })
+ await fs.promises.copyFile(src, dest)
+ yield dest
+ }
},
+ async *partialEmit() {},
})
--
Gitblit v1.10.0