move twind config into @eno.app
that may need to change later
This commit is contained in:
parent
fe02721687
commit
cd7599dcc9
@ -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":
|
||||
{
|
||||
|
@ -1,3 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
export default ()=> <div>dummy app</div>
|
@ -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 <div class="p-4 font-sans">
|
||||
return <div class="p-4 font-sans">
|
||||
<h1 class="my-2 font(bold serif) text(2xl)">Title!!</h1>
|
||||
<h2>subtitle</h2>
|
||||
<Component/>
|
||||
</div>;
|
||||
</div>;
|
||||
};
|
||||
|
||||
export const CSS = {
|
||||
presets: [TWPreTail(), TWPreAuto()],
|
||||
hash:false
|
||||
};
|
30
server.tsx
30
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(<App.default/>), TWInst);
|
||||
const results = Twind.extract(SSR(<App/>), TwindInst);
|
||||
|
||||
type = `text/html`;
|
||||
body = `<!doctype html>
|
||||
@ -239,23 +237,11 @@ FileListen("${url.pathname}", reloadHandler);`;
|
||||
<body>
|
||||
<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";
|
||||
import TWPreAuto from "https://esm.sh/@twind/preset-autoprefix@1.0.1";
|
||||
|
||||
const Configure = {presets: [TWPreTail(), TWPreAuto()]};
|
||||
const ShadowDOM = document.querySelector("#app").attachShadow({mode: "open"});
|
||||
const ShadowDiv = document.createElement("div");
|
||||
const ShadowCSS = document.createElement("style");
|
||||
ShadowDOM.append(ShadowCSS);
|
||||
ShadowDOM.append(ShadowDiv);
|
||||
|
||||
TW.observe(TW.twind(Configure, TW.cssom(ShadowCSS)), ShadowDiv);
|
||||
|
||||
import App from "@eno/app";
|
||||
import {render, createElement as H} from "react";
|
||||
render(H(()=>H(App)), ShadowDiv);
|
||||
|
||||
import * as Twind from "https://esm.sh/@twind/core@1.1.3";
|
||||
import {default as App, CSS} from "@eno/app";
|
||||
Twind.install(CSS);
|
||||
render(H(()=>H(App)), document.querySelector("#app"));
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
Loading…
Reference in New Issue
Block a user