chore: add a head component to generated project (#771)

This PR adds a `<Head>` component to projects generated using `init.ts`.
This commit is contained in:
hashrock
2022-09-15 15:00:25 +02:00
committed by GitHub
parent 758b56569a
commit 3b0c4b3b67
+10 -2
View File
@@ -93,14 +93,21 @@ await Deno.writeTextFile(
IMPORT_MAP_JSON, IMPORT_MAP_JSON,
); );
const ROUTES_INDEX_TSX = `import Counter from "../islands/Counter.tsx"; const ROUTES_INDEX_TSX = `import { Head } from "$fresh/runtime.ts";
import Counter from "../islands/Counter.tsx";
export default function Home() { export default function Home() {
return ( return (
<>
<Head>
<title>Fresh App</title>
</Head>
<div${useTwind ? ` class="p-4 mx-auto max-w-screen-md"` : ""}> <div${useTwind ? ` class="p-4 mx-auto max-w-screen-md"` : ""}>
<img <img
src="/logo.svg" src="/logo.svg"
${useTwind ? `class="w-32 h-32"` : `width="128"\n height="128"`} ${
useTwind ? `class="w-32 h-32"` : `width="128"\n height="128"`
}
alt="the fresh logo: a sliced lemon dripping with juice" alt="the fresh logo: a sliced lemon dripping with juice"
/> />
<p${useTwind ? ` class="my-6"` : ""}> <p${useTwind ? ` class="my-6"` : ""}>
@@ -109,6 +116,7 @@ export default function Home() {
</p> </p>
<Counter start={3} /> <Counter start={3} />
</div> </div>
</>
); );
} }
`; `;