| | |
| | | import HeaderConstructor from "./Header" |
| | | import BodyConstructor from "./Body" |
| | | import { JSResourceToScriptElement, StaticResources } from "../util/resources" |
| | | import { FullSlug, joinSegments, pathToRoot } from "../util/path" |
| | | import { FullSlug, RelativeURL, joinSegments } from "../util/path" |
| | | |
| | | interface RenderComponents { |
| | | head: QuartzComponent |
| | |
| | | footer: QuartzComponent |
| | | } |
| | | |
| | | export function pageResources(slug: FullSlug, staticResources: StaticResources): StaticResources { |
| | | const baseDir = pathToRoot(slug) |
| | | |
| | | export function pageResources( |
| | | baseDir: FullSlug | RelativeURL, |
| | | staticResources: StaticResources, |
| | | ): StaticResources { |
| | | const contentIndexPath = joinSegments(baseDir, "static/contentIndex.json") |
| | | const contentIndexScript = `const fetchData = fetch(\`${contentIndexPath}\`).then(data => data.json())` |
| | | |
| | |
| | | css: [joinSegments(baseDir, "index.css"), ...staticResources.css], |
| | | js: [ |
| | | { |
| | | src: joinSegments(baseDir, "/prescript.js"), |
| | | src: joinSegments(baseDir, "prescript.js"), |
| | | loadTime: "beforeDOMReady", |
| | | contentType: "external", |
| | | }, |
| | |
| | | }, |
| | | ...staticResources.js, |
| | | { |
| | | src: baseDir + "/postscript.js", |
| | | src: joinSegments(baseDir, "postscript.js"), |
| | | loadTime: "afterDOMReady", |
| | | moduleType: "module", |
| | | contentType: "external", |