From 527ce6546e7ec50e7720ff7b9b6ff79a89c3b7fc Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 08 Aug 2023 04:41:18 +0000
Subject: [PATCH] various css fixes, fix new image loading bug when previewing, path docs
---
quartz/build.ts | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/quartz/build.ts b/quartz/build.ts
index ae5fd40..05edf86 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -23,7 +23,7 @@
import { filterContent } from "./processors/filter"
import { emitContent } from "./processors/emit"
import cfg from "../quartz.config"
-import { FilePath, joinSegments, slugifyFilePath } from "./path"
+import { FilePath, ServerSlug, joinSegments, slugifyFilePath } from "./path"
import chokidar from "chokidar"
import { ProcessedContent } from "./plugins/vfile"
import { Argv, BuildCtx } from "./ctx"
@@ -91,6 +91,7 @@
contentMap.set(vfile.data.filePath!, content)
}
+ const initialSlugs = ctx.allSlugs
let timeoutId: ReturnType<typeof setTimeout> | null = null
let toRebuild: Set<FilePath> = new Set()
let toRemove: Set<FilePath> = new Set()
@@ -102,20 +103,19 @@
}
// dont bother rebuilding for non-content files, just track and refresh
+ fp = toPosixPath(fp)
+ const filePath = joinSegments(argv.directory, fp) as FilePath
if (path.extname(fp) !== ".md") {
- fp = toPosixPath(fp)
- const filePath = joinSegments(argv.directory, fp) as FilePath
if (action === "add" || action === "change") {
trackedAssets.add(filePath)
} else if (action === "delete") {
- trackedAssets.add(filePath)
+ trackedAssets.delete(filePath)
}
clientRefresh()
return
}
- fp = toPosixPath(fp)
- const filePath = joinSegments(argv.directory, fp) as FilePath
+
if (action === "add" || action === "change") {
toRebuild.add(filePath)
} else if (action === "delete") {
@@ -133,10 +133,12 @@
try {
const filesToRebuild = [...toRebuild].filter((fp) => !toRemove.has(fp))
- ctx.allSlugs = [...new Set([...contentMap.keys(), ...toRebuild, ...trackedAssets])]
- .filter((fp) => !toRemove.has(fp))
- .map((fp) => slugifyFilePath(path.posix.relative(argv.directory, fp) as FilePath))
+ const trackedSlugs =
+ [...new Set([...contentMap.keys(), ...toRebuild, ...trackedAssets])]
+ .filter((fp) => !toRemove.has(fp))
+ .map((fp) => slugifyFilePath(path.posix.relative(argv.directory, fp) as FilePath))
+ ctx.allSlugs = [...new Set([...initialSlugs, ...trackedSlugs])]
const parsedContent = await parseMarkdown(ctx, filesToRebuild)
for (const content of parsedContent) {
const [_tree, vfile] = content
--
Gitblit v1.10.0