From cd7599dcc986e253c57222561c8f2641752494ab Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Mon, 3 Apr 2023 23:35:10 -0400 Subject: [PATCH] move twind config into @eno.app that may need to change later --- deno.json | 2 +- dummy-app.tsx | 3 --- example/app.tsx | 22 +++++++++++++++------- server.tsx | 30 ++++++++---------------------- 4 files changed, 24 insertions(+), 33 deletions(-) delete mode 100644 dummy-app.tsx diff --git a/deno.json b/deno.json index 8fa5fd1..137c482 100644 --- a/deno.json +++ b/deno.json @@ -6,7 +6,7 @@ "react": "https://esm.sh/preact@10.13.2/compat", "react-original": "https://esm.sh/preact@10.13.2/compat", - "@eno/app": "./dummy-app.tsx" + "@eno/app": "./example/app.tsx" }, "tasks": { diff --git a/dummy-app.tsx b/dummy-app.tsx deleted file mode 100644 index 70c39dc..0000000 --- a/dummy-app.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import React from "react"; - -export default ()=>
dummy app
\ No newline at end of file diff --git a/example/app.tsx b/example/app.tsx index fd1825c..4de6dc2 100644 --- a/example/app.tsx +++ b/example/app.tsx @@ -1,11 +1,19 @@ +import TWPreTail from "https://esm.sh/@twind/preset-tailwind@1.1.4"; +import TWPreAuto from "https://esm.sh/@twind/preset-autoprefix@1.0.7"; import React from "react"; import Component from "./deep/component.tsx"; -export default ()=>{ +export default ()=> +{ const [countGet, countSet] = React.useState(1); -return
-

Title!!

-

subtitle

- -
; -}; \ No newline at end of file + return
+

Title!!

+

subtitle

+ +
; +}; + +export const CSS = { + presets: [TWPreTail(), TWPreAuto()], + hash:false +}; diff --git a/server.tsx b/server.tsx index e749594..ad62492 100644 --- a/server.tsx +++ b/server.tsx @@ -127,12 +127,10 @@ catch(e) console.log(`deno.json not found`); } -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"; +import {default as App, CSS} from "@eno/app"; +import * as Twind from "https://esm.sh/@twind/core@1.1.3"; +const TwindInst = Twind.install(CSS); -const TWInst = TW.install({presets: [TWPreTail(), TWPreAuto()], hash:false}); Deno.serve({ port: 3000 }, async(_req:Request) => { @@ -225,7 +223,7 @@ FileListen("${url.pathname}", reloadHandler);`; } else { - const results = TW.extract(SSR(), TWInst); + const results = Twind.extract(SSR(), TwindInst); type = `text/html`; body = ` @@ -239,23 +237,11 @@ FileListen("${url.pathname}", reloadHandler);`;
${results.html}
`;