From fe0272168761c7c4f83003f037301d76c28b0f8a Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sun, 2 Apr 2023 14:16:46 -0400 Subject: [PATCH 1/2] hard-coded twind config for now --- deno.json | 3 ++- server.tsx | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index 6ccafe7..8fa5fd1 100644 --- a/deno.json +++ b/deno.json @@ -3,8 +3,9 @@ "deno.window", "DOM" ]}, "imports": { - "react-original": "https://esm.sh/preact@10.13.2/compat", "react": "https://esm.sh/preact@10.13.2/compat", + + "react-original": "https://esm.sh/preact@10.13.2/compat", "@eno/app": "./dummy-app.tsx" }, "tasks": diff --git a/server.tsx b/server.tsx index 2ecf332..e749594 100644 --- a/server.tsx +++ b/server.tsx @@ -1,7 +1,7 @@ import * as ESBuild from 'https://deno.land/x/esbuild@v0.14.45/mod.js'; import * as MIME from "https://deno.land/std@0.180.0/media_types/mod.ts"; import { debounce } from "https://deno.land/std@0.151.0/async/debounce.ts"; -import SSR from "https://esm.sh/v113/preact-render-to-string@6.0.2/deno/preact-render-to-string.mjs"; +import SSR from "https://esm.sh/v113/preact-render-to-string@6.0.2"; import React, {createElement as h} from "react"; const Transpiled = new Map(); @@ -128,6 +128,11 @@ catch(e) } const App = await import("@eno/app"); +import * as TW from "https://esm.sh/@twind/core@1.0.1"; +import TWPreTail from "https://esm.sh/@twind/preset-tailwind@1.0.1"; +import TWPreAuto from "https://esm.sh/@twind/preset-autoprefix@1.0.1"; + +const TWInst = TW.install({presets: [TWPreTail(), TWPreAuto()], hash:false}); Deno.serve({ port: 3000 }, async(_req:Request) => { @@ -220,16 +225,19 @@ FileListen("${url.pathname}", reloadHandler);`; } else { + const results = TW.extract(SSR(), TWInst); + type = `text/html`; body = ` + -
${SSR()}
+
${results.html}
`; -- 2.34.1