#12 issue/iso-components #13

Merged
SethTrowbridge merged 3 commits from issue/iso-components into master 2023-04-07 21:41:21 -04:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 767e681640 - Show all commits

View File

@ -14,6 +14,6 @@
"install": "deno install -f -A --unstable --no-lock -n eno server.tsx", "install": "deno install -f -A --unstable --no-lock -n eno server.tsx",
"run": "deno run -A --unstable --no-lock server.tsx", "run": "deno run -A --unstable --no-lock server.tsx",
"host": "deno run -A --unstable https://deno.land/std@0.181.0/http/file_server.ts", "host": "deno run -A --unstable https://deno.land/std@0.181.0/http/file_server.ts",
"complete": "deno task host & cd example && pwd && deno task dev" "example": "cd example && pwd && deno task dev"
} }
} }

View File

@ -4,6 +4,7 @@ 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"; import SSR from "https://esm.sh/v113/preact-render-to-string@6.0.2";
import * as Twind from "https://esm.sh/@twind/core@1.1.3"; import * as Twind from "https://esm.sh/@twind/core@1.1.3";
import React, {JSX, createElement as h} from "react"; import React, {JSX, createElement as h} from "react";
import * as Iso from "@eno/iso";
const Transpiled = new Map(); const Transpiled = new Map();
const Transpileable =(inFilePath:string):boolean=> const Transpileable =(inFilePath:string):boolean=>
@ -233,9 +234,11 @@ FileListen("${url.pathname}", reloadHandler);`;
type = `text/html`; type = `text/html`;
body = `<!doctype html> body = `<!doctype html>
<html> <html lang="en">
<head> <head>
<title>${Iso.Meta.title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8"/>
<style data-twind>${results.css}</style> <style data-twind>${results.css}</style>
<script type="importmap">${JSON.stringify(ImportObject)}</script> <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> <script async src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js" crossorigin="anonymous"></script>
@ -253,7 +256,7 @@ FileListen("${url.pathname}", reloadHandler);`;
</html>`; </html>`;
} }
return new Response(body, {headers:{"content-type":type as string, "Access-Control-Allow-Origin":"*"}}); return new Response(body, {headers:{"content-type":type as string, "Access-Control-Allow-Origin":"*", charset:"utf-8"}});
} }
catch(error) catch(error)
{ {