| | |
| | | import { googleFontHref, joinStyles } from '../theme' |
| | | import { EmitCallback, PluginTypes } from './types' |
| | | import styles from '../styles/base.scss' |
| | | // @ts-ignore |
| | | import spaRouterScript from '../components/scripts/spa.inline' |
| | | |
| | | export type ComponentResources = { |
| | | css: string[], |
| | |
| | | |
| | | export function emitComponentResources(cfg: GlobalConfiguration, resources: StaticResources, plugins: PluginTypes, emit: EmitCallback) { |
| | | const fps: string[] = [] |
| | | const allComponents: Set<QuartzComponent<any>> = new Set() |
| | | const allComponents: Set<QuartzComponent> = new Set() |
| | | for (const emitter of plugins.emitters) { |
| | | const components = emitter.getQuartzComponents() |
| | | for (const component of components) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (cfg.enableSPA) { |
| | | componentResources.afterDOMLoaded.push(spaRouterScript) |
| | | } else { |
| | | componentResources.afterDOMLoaded.push(` |
| | | const event = new CustomEvent("nav", { detail: { slug: document.body.dataset.slug } }) |
| | | document.dispatchEvent(event)` |
| | | ) |
| | | } |
| | | |
| | | emit({ |
| | | slug: "index", |
| | | ext: ".css", |