/** @jsx h */ /** @jsxFrag Fragment */ import { ComponentChildren, Fragment, h } from "preact"; import { asset, Head } from "$fresh/runtime.ts"; import { Handlers, PageProps } from "$fresh/server.ts"; import { tw } from "@twind"; import Counter from "../islands/Counter.tsx"; import LemonDrop from "../islands/LemonDrop.tsx"; import Footer from "../components/Footer.tsx"; import { Leaf } from "../components/Icons.tsx"; import VERSIONS from "../../versions.json" assert { type: "json" }; export const handler: Handlers = { GET(req, ctx) { const accept = req.headers.get("accept"); if (accept && !accept.includes("text/html")) { const path = `https://deno.land/x/fresh@${VERSIONS[0]}/init.ts`; return new Response(`Redirecting to ${path}`, { headers: { "Location": path }, status: 307, }); } return ctx.render(); }, }; const TITLE = "fresh - The next-gen web framework."; const DESCRIPTION = "Just in time edge rendering, island based interactivity, and no configuration TypeScript support using Deno."; export default function MainPage(props: PageProps) { const ogImageUrl = new URL(asset("/home-og.png"), props.url).href; const origin = `${props.url.protocol}//${props.url.host}`; return ( <> {TITLE}
); } function Hero() { const container = tw `w-full flex justify-center items-center flex-col bg-green-300`; const nav = tw`flex justify-end items-center bg-green-300`; const a = tw `border(1 black) inline-flex items-center h-10 px-4 m-4 text-black bg-transparent rounded hover:bg-white`; return (
Documentation
); } export interface ListItemProps { children: ComponentChildren; } function ListItem(props: ListItemProps) { return (
{props.children}
); } function Intro() { const title = tw `py-4 text(4xl sm:4xl lg:4xl gray-900 center) sm:tracking-tight font-extrabold`; return (
deno is drinking fresh lemon squash

The next-gen web framework.

Fresh is a next generation web framework, built for speed, reliability, and simplicity. Some stand out features:

Just-in-time rendering on the edge. Island based client hydration for maximum interactivity. Zero runtime overhead: no JS is shipped to the client by default. No build step. No configuration necessary. TypeScript support out of the box.

Fresh embraces the tried and true design of server side rendering and progressive enhancement on the client side.

); } function GettingStarted(props: { origin: string }) { return (

Getting started

To get started, make sure you have the{" "} Deno CLI {" "} version 1.23.0 or higher installed.

Then you can use the Fresh init script to bootstrap a new project:

        {`deno run -A -r ${props.origin} my-app`}
      

Enter the newly created project directory and run the following command to start the development server:

        deno task start
      

You can now open{" "} http://localhost:8000 {" "} in your browser to view the page.

A more in-depth getting started guide is available in{" "} the docs.

); } const timeFmt = new Intl.DateTimeFormat("en-US", { timeStyle: "long", hour12: false, }); function Example() { return (

Example

This text is being server side rendered on the fly. It was rendered at {" "} {timeFmt.format(new Date())}.

The counter below was rendered on the server with a starting value of 3, and was then hydrated on the client to provide interactivity. Try out the buttons!

Only the JS required to render that counter is sent to the client.

); }