This commit is contained in:
betalabor.de
2026-04-27 21:23:31 +02:00
parent 813dfbcbd9
commit 6513d2880e
2 changed files with 6 additions and 12 deletions

View File

@@ -249,16 +249,12 @@ const de = lang === "de";
`${window.location.origin}/styles/global.css`, `${window.location.origin}/styles/global.css`,
).then((r) => r.text()); ).then((r) => r.text());
} catch (e) {} } catch (e) {}
// ── NEU: Astro-generierte CSS-Dateien fetchen ──────────────────
// ── NEU: Alle lokalen Link-Stylesheets fetchen (Astro Component CSS) ──
const linkedCss = ( const linkedCss = (
await Promise.all( await Promise.all(
Array.from(document.querySelectorAll('link[rel="stylesheet"]')) Array.from(document.querySelectorAll('link[rel="stylesheet"]'))
.map((l) => l.href) .map((l) => l.href)
.filter( .filter((href) => href.startsWith(origin)) // nur lokale, keine Google Fonts
(href) =>
href.startsWith(origin) && !href.includes("fonts.googleapis"),
)
.map((href) => .map((href) =>
fetch(href) fetch(href)
.then((r) => r.text()) .then((r) => r.text())
@@ -266,7 +262,7 @@ const de = lang === "de";
), ),
) )
).join("\n"); ).join("\n");
// ───────────────────────────────────────────────────────────────
const inlineStyles = Array.from(document.querySelectorAll("style")) const inlineStyles = Array.from(document.querySelectorAll("style"))
.map((s) => s.textContent) .map((s) => s.textContent)
.join("\n"); .join("\n");

View File

@@ -501,15 +501,12 @@ function j(v: any) {
).then((r) => r.text()); ).then((r) => r.text());
} catch (e) {} } catch (e) {}
// ── NEU: Alle lokalen Link-Stylesheets fetchen (Astro Component CSS) ── // ── NEU: Astro-generierte CSS-Dateien fetchen ──────────────────
const linkedCss = ( const linkedCss = (
await Promise.all( await Promise.all(
Array.from(document.querySelectorAll('link[rel="stylesheet"]')) Array.from(document.querySelectorAll('link[rel="stylesheet"]'))
.map((l) => l.href) .map((l) => l.href)
.filter( .filter((href) => href.startsWith(origin)) // nur lokale, keine Google Fonts
(href) =>
href.startsWith(origin) && !href.includes("fonts.googleapis"),
)
.map((href) => .map((href) =>
fetch(href) fetch(href)
.then((r) => r.text()) .then((r) => r.text())
@@ -517,6 +514,7 @@ function j(v: any) {
), ),
) )
).join("\n"); ).join("\n");
// ───────────────────────────────────────────────────────────────
const inlineStyles = Array.from(document.querySelectorAll("style")) const inlineStyles = Array.from(document.querySelectorAll("style"))
.map((s) => s.textContent) .map((s) => s.textContent)