This commit is contained in:
betalabor.de
2026-04-27 21:16:21 +02:00
parent afca68db7f
commit 813dfbcbd9
2 changed files with 36 additions and 0 deletions

View File

@@ -250,6 +250,23 @@ const de = lang === "de";
).then((r) => r.text());
} catch (e) {}
// ── NEU: Alle lokalen Link-Stylesheets fetchen (Astro Component CSS) ──
const linkedCss = (
await Promise.all(
Array.from(document.querySelectorAll('link[rel="stylesheet"]'))
.map((l) => l.href)
.filter(
(href) =>
href.startsWith(origin) && !href.includes("fonts.googleapis"),
)
.map((href) =>
fetch(href)
.then((r) => r.text())
.catch(() => ""),
),
)
).join("\n");
const inlineStyles = Array.from(document.querySelectorAll("style"))
.map((s) => s.textContent)
.join("\n");
@@ -281,6 +298,7 @@ const de = lang === "de";
<link href="${fontUrl}" rel="stylesheet">
<style>
${globalCss}
${linkedCss}
${inlineStyles}
html { margin: 0; padding: 0; }
body { margin: 0 !important; padding: 0 !important; display: flex; justify-content: center; background: white; }

View File

@@ -501,6 +501,23 @@ function j(v: any) {
).then((r) => r.text());
} catch (e) {}
// ── NEU: Alle lokalen Link-Stylesheets fetchen (Astro Component CSS) ──
const linkedCss = (
await Promise.all(
Array.from(document.querySelectorAll('link[rel="stylesheet"]'))
.map((l) => l.href)
.filter(
(href) =>
href.startsWith(origin) && !href.includes("fonts.googleapis"),
)
.map((href) =>
fetch(href)
.then((r) => r.text())
.catch(() => ""),
),
)
).join("\n");
const inlineStyles = Array.from(document.querySelectorAll("style"))
.map((s) => s.textContent)
.join("\n");
@@ -532,6 +549,7 @@ function j(v: any) {
<link href="${fontUrl}" rel="stylesheet">
<style>
${globalCss}
${linkedCss}
${inlineStyles}
@page { size: A4 portrait; margin: 0; }
html { margin: 0; padding: 0; }