hard-coded twind config for now

This commit is contained in:
Seth Trowbridge 2023-04-02 14:16:46 -04:00
parent 4ff0da09a3
commit fe02721687
2 changed files with 12 additions and 3 deletions

View File

@ -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":

View File

@ -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(<App.default/>), TWInst);
type = `text/html`;
body = `<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style data-twind>${results.css}</style>
<script type="importmap">${JSON.stringify(ImportObject)}</script>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js" crossorigin="anonymous"></script>
</head>
<body>
<div id="app">${SSR(<App.default/>)}</div>
<div id="app">${results.html}</div>
<script type="module">
import * as TW from "https://esm.sh/@twind/core@1.0.1";
import TWPreTail from "https://esm.sh/@twind/preset-tailwind@1.0.1";