From 42d3a7de1711bbd40a2b6857e3bf7ff17685f5d9 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 01 Jun 2023 21:35:31 +0000
Subject: [PATCH] scss support
---
quartz/plugins/emitters/contentPage.tsx | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/quartz/plugins/emitters/contentPage.tsx b/quartz/plugins/emitters/contentPage.tsx
index 56a2a15..08d989b 100644
--- a/quartz/plugins/emitters/contentPage.tsx
+++ b/quartz/plugins/emitters/contentPage.tsx
@@ -1,5 +1,4 @@
import { toJsxRuntime } from "hast-util-to-jsx-runtime"
-import { resolveToRoot } from "../../path"
import { StaticResources } from "../../resources"
import { EmitCallback, QuartzEmitterPlugin } from "../types"
import { ProcessedContent } from "../vfile"
@@ -8,6 +7,10 @@
import { ComponentType } from "preact"
import { HeadProps } from "../../components/Head"
+import styles from '../../styles/base.scss'
+import { googleFontHref, templateThemeStyles } from "../../theme"
+import { GlobalConfiguration } from "../../cfg"
+
interface Options {
Head: ComponentType<HeadProps>
}
@@ -21,8 +24,18 @@
this.opts = opts
}
- async emit(content: ProcessedContent[], resources: StaticResources, emit: EmitCallback): Promise<string[]> {
+ async emit(cfg: GlobalConfiguration, content: ProcessedContent[], resources: StaticResources, emit: EmitCallback): Promise<string[]> {
const fps: string[] = []
+
+ // emit styles
+ emit({
+ slug: "index",
+ ext: ".css",
+ content: templateThemeStyles(cfg.theme, styles)
+ })
+ fps.push("index.css")
+ resources.css.push(googleFontHref(cfg.theme))
+
for (const [tree, file] of content) {
// @ts-ignore (preact makes it angry)
@@ -36,7 +49,7 @@
slug={file.data.slug!}
externalResources={resources} />
<body>
- <div id="quartz-root">
+ <div id="quartz-root" class="page">
<header>
<h1>{file.data.frontmatter?.title}</h1>
</header>
--
Gitblit v1.10.0