-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds initial documentation site infrastructure.
Refs #16. This just sets up a new `@rules_prerender` site which says "Hello, World!".
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
load("//:index.bzl", "prerender_pages", "web_resources_devserver") | ||
load("//tools/typescript:defs.bzl", "ts_project") | ||
|
||
prerender_pages( | ||
name = "site", | ||
entry_point = "./site.js", | ||
prerender = ":prerender", | ||
bundle_js = False, # Optimization: No runtime JavaScript yet. | ||
) | ||
|
||
ts_project( | ||
name = "prerender", | ||
srcs = ["site.tsx"], | ||
deps = [ | ||
"//docs/components/layout:layout_prerender", | ||
"//:node_modules/@rules_prerender/preact", | ||
], | ||
) | ||
|
||
web_resources_devserver( | ||
name = "devserver", | ||
resources = ":site", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load("//:index.bzl", "prerender_component") | ||
load("//tools/typescript:defs.bzl", "ts_project") | ||
|
||
prerender_component( | ||
name = "layout", | ||
prerender = ":prerender", | ||
visibility = ["//docs:__subpackages__"], | ||
) | ||
|
||
ts_project( | ||
name = "prerender", | ||
srcs = ["layout.tsx"], | ||
deps = ["//:node_modules/preact"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { VNode } from 'preact'; | ||
|
||
/** TODO */ | ||
export function Layout({ title, children }: { title: string, children: VNode }): VNode { | ||
return <html lang="en"> | ||
<head> | ||
<meta charSet="utf8" /> | ||
<title>@rules_prerender - {title}</title> | ||
</head> | ||
<body> | ||
<main>{children}</main> | ||
</body> | ||
</html>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Layout } from './components/layout/layout.js'; | ||
import { PrerenderResource, renderToHtml } from '@rules_prerender/preact'; | ||
|
||
export default function*(): Generator<PrerenderResource, void, void> { | ||
yield PrerenderResource.fromHtml('/index.html', renderToHtml( | ||
<Layout title="Documentation Home"> | ||
<div>Hello World!</div> | ||
</Layout> | ||
)); | ||
} |