From 429f331c212d598b0d7ff44f20f75cf007bcf32b Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 03 Aug 2023 03:53:13 +0000
Subject: [PATCH] make ci also run on windows, re-add css minification

---
 quartz/build.ts |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/quartz/build.ts b/quartz/build.ts
index b96c462..9bd1e67 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -10,7 +10,7 @@
 import { filterContent } from "./processors/filter"
 import { emitContent } from "./processors/emit"
 import cfg from "../quartz.config"
-import { FilePath, slugifyFilePath } from "./path"
+import { FilePath, joinSegments, slugifyFilePath } from "./path"
 import chokidar from "chokidar"
 import { ProcessedContent } from "./plugins/vfile"
 import WebSocket, { WebSocketServer } from "ws"
@@ -42,16 +42,18 @@
   console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`)
 
   perf.addEvent("glob")
-  const fps = await globby("**/*.md", {
-    cwd: argv.directory,
-    ignore: cfg.configuration.ignorePatterns,
-    gitignore: true,
-  })
+  const fps = (
+    await globby("**/*.md", {
+      cwd: argv.directory,
+      ignore: cfg.configuration.ignorePatterns,
+      gitignore: true,
+    })
+  ).map((fp) => fp.split(path.sep).join(path.posix.sep))
   console.log(
     `Found ${fps.length} input files from \`${argv.directory}\` in ${perf.timeSince("glob")}`,
   )
 
-  const filePaths = fps.map((fp) => `${argv.directory}${path.sep}${fp}` as FilePath)
+  const filePaths = fps.map((fp) => joinSegments(argv.directory, fp) as FilePath)
   ctx.allSlugs = fps.map((fp) => slugifyFilePath(fp as FilePath))
 
   const parsedFiles = await parseMarkdown(ctx, filePaths)
@@ -81,8 +83,9 @@
   let toRebuild: Set<FilePath> = new Set()
   let toRemove: Set<FilePath> = new Set()
   async function rebuild(fp: string, action: "add" | "change" | "delete") {
+    fp = fp.split(path.sep).join(path.posix.sep)
     if (!ignored(fp)) {
-      const filePath = `${argv.directory}${path.sep}${fp}` as FilePath
+      const filePath = joinSegments(argv.directory, fp) as FilePath
       if (action === "add" || action === "change") {
         toRebuild.add(filePath)
       } else if (action === "delete") {

--
Gitblit v1.10.0