From b87f7ee5dcb852e7f10f8d8a389dbda2bca55f95 Mon Sep 17 00:00:00 2001 From: Ayo Date: Tue, 10 Oct 2023 22:50:11 +0200 Subject: [PATCH] feat: don't limit server script to head --- routes/[...index].ts | 4 +--- src/pages/404.html | 5 ++++- src/pages/about.html | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/routes/[...index].ts b/routes/[...index].ts index 91d520c..6899fbf 100644 --- a/routes/[...index].ts +++ b/routes/[...index].ts @@ -47,12 +47,10 @@ function doSetUp(html: string) { const { attributes } = node; const attributeKeys = Object.keys(attributes ?? {}); const isServerScript = attributeKeys.some((key) => key.includes("server:")); - const isInHead = node.parent?.name === "head"; if ( node.type === ELEMENT_NODE && node.name === "script" && - isServerScript && - isInHead + isServerScript ) { const scripts = node.children.map((child) => child.value); serverScripts.push(scripts.join(" ")); diff --git a/src/pages/404.html b/src/pages/404.html index 5abe1ef..138460b 100644 --- a/src/pages/404.html +++ b/src/pages/404.html @@ -1 +1,4 @@ -wow we can't find that + +{{greeting}}!! wow we can't find that diff --git a/src/pages/about.html b/src/pages/about.html index a882dfd..d4cb62b 100644 --- a/src/pages/about.html +++ b/src/pages/about.html @@ -4,9 +4,12 @@ top about + Home -

Top Level About

+

{{greeting}}!!! Top Level About