| | |
| | | import { googleFontHref, joinStyles } from "../../util/theme" |
| | | import { Features, transform } from "lightningcss" |
| | | import { transform as transpile } from "esbuild" |
| | | import { write } from "./helpers" |
| | | |
| | | type ComponentResources = { |
| | | css: string[] |
| | |
| | | function gtag() { dataLayer.push(arguments); } |
| | | gtag("js", new Date()); |
| | | gtag("config", "${tagId}", { send_page_view: false }); |
| | | |
| | | |
| | | document.addEventListener("nav", () => { |
| | | gtag("event", "page_view", { |
| | | page_title: document.title, |
| | |
| | | umamiScript.src = "https://analytics.umami.is/script.js" |
| | | umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}") |
| | | umamiScript.async = true |
| | | |
| | | |
| | | document.head.appendChild(umamiScript) |
| | | `) |
| | | } |
| | |
| | | getQuartzComponents() { |
| | | return [] |
| | | }, |
| | | async emit(ctx, _content, resources, emit): Promise<FilePath[]> { |
| | | async emit(ctx, _content, resources): Promise<FilePath[]> { |
| | | // component specific scripts and styles |
| | | const componentResources = getComponentResources(ctx) |
| | | // important that this goes *after* component scripts |
| | |
| | | ]) |
| | | |
| | | const fps = await Promise.all([ |
| | | emit({ |
| | | write({ |
| | | ctx, |
| | | slug: "index" as FullSlug, |
| | | ext: ".css", |
| | | content: transform({ |
| | |
| | | include: Features.MediaQueries, |
| | | }).code.toString(), |
| | | }), |
| | | emit({ |
| | | write({ |
| | | ctx, |
| | | slug: "prescript" as FullSlug, |
| | | ext: ".js", |
| | | content: prescript, |
| | | }), |
| | | emit({ |
| | | write({ |
| | | ctx, |
| | | slug: "postscript" as FullSlug, |
| | | ext: ".js", |
| | | content: postscript, |