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
+21 -13
View File
@@ -93,22 +93,30 @@ 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 (
<div${useTwind ? ` class="p-4 mx-auto max-w-screen-md"` : ""}> <>
<img <Head>
src="/logo.svg" <title>Fresh App</title>
${useTwind ? `class="w-32 h-32"` : `width="128"\n height="128"`} </Head>
alt="the fresh logo: a sliced lemon dripping with juice" <div${useTwind ? ` class="p-4 mx-auto max-w-screen-md"` : ""}>
/> <img
<p${useTwind ? ` class="my-6"` : ""}> src="/logo.svg"
Welcome to \`fresh\`. Try updating this message in the ./routes/index.tsx ${
file, and refresh. useTwind ? `class="w-32 h-32"` : `width="128"\n height="128"`
</p> }
<Counter start={3} /> alt="the fresh logo: a sliced lemon dripping with juice"
</div> />
<p${useTwind ? ` class="my-6"` : ""}>
Welcome to \`fresh\`. Try updating this message in the ./routes/index.tsx
file, and refresh.
</p>
<Counter start={3} />
</div>
</>
); );
} }
`; `;