Skip to content

Commit 0cb25a0

Browse files
committed
Improve preact example
1 parent 0ec6f19 commit 0cb25a0

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ npm install top-bun
2323

2424
## Usage
2525

26-
``` console
26+
```console
2727
$ top-bun --help
2828
Usage: top-bun [options]
2929

@@ -95,6 +95,30 @@ The core idea of `top-bun` is that a `src` directory of markdown, html and js "i
9595

9696
It ships with sane defaults so that you can point `top-bun` at a standard [markdown documented repository](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github) and have it build a website with near-zero preparation.
9797

98+
## Examples
99+
100+
A collection of examples can be found in the [`./examples`](./examples) folder.
101+
102+
To run examples:
103+
104+
```console
105+
$ git clone [email protected]:bcomnes/top-bun.git
106+
$ cd top-bun
107+
$ npm i
108+
$ npm run example:{example-name}
109+
$ npm i
110+
$ npm start
111+
```
112+
113+
### Additional examples
114+
115+
Here are some additional external examples of larger top-bun projects.
116+
If you have an project that uses top-bun and could act as a nice example, please PR it to the list!
117+
118+
- [Blog Example](https://github.com/bcomnes/bret.io/)
119+
- [Isomorphic Static/Client App](https://github.com/hifiwi-fi/breadcrum.net/tree/master/packages/web/client)
120+
- [Zero-Conf Markdown Docs](https://github.com/bcomnes/deploy-to-neocities/blob/70b264bcb37fca5b21e45d6cba9265f97f6bfa6f/package.json#L38)
121+
98122
## Pages
99123

100124
Pages are a named directories inside of `src`, with **one of** the following page files inside of it.

examples/preact/src/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Preact example
22

3-
This is a preact example.
3+
This is a preact example.
4+
5+
[Isomorphic Component Rendering](./isomorphic/)

examples/preact/src/isomorphic/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class App extends Component {
4444
}
4545

4646
export const page = () => html`
47-
<${App}/>
47+
<${App} page="Isomorphic"/>
4848
<${Footer}>footer content here<//>
4949
<${Footer}>footer content here<//>
5050
`

examples/preact/src/layouts/root.layout.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ export default function defaultRootLayout ({
4848
`)}
4949
${render(html`
5050
<body class="safe-area-inset">
51-
<main class="mine-layout app-main">
52-
${typeof children === 'string'
53-
? html`<main class="mine-layout app-main" dangerouslySetInnerHTML="${{ __html: children }}"/>`
54-
: html`<main class="mine-layout app-main">${children}</main>`
55-
}
56-
</main>
51+
${typeof children === 'string'
52+
? html`<main class="mine-layout app-main" dangerouslySetInnerHTML="${{ __html: children }}"/>`
53+
: html`<main class="mine-layout app-main">${children}</main>`
54+
}
5755
</body>
5856
`)}
5957
</html>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"clean:public": "rm -rf public && mkdir -p public",
9797
"clean:declarations-top": "rm -rf $(find . -maxdepth 1 -type f -name '*.d.ts*')",
9898
"clean:declarations-lib": "rm -rf $(find lib -type f -name '*.d.ts*' ! -name '*-types.d.ts')",
99+
"clean-node_modules": "rm -rf node_modules && rm -rf examples/*/node_modules",
99100
"build": "npm run clean && run-p build:*",
100101
"build:top-bun": "./bin.js --src . --ignore examples,test-cases,coverage,*.tsconfig.json",
101102
"build:declaration": "tsc -p declaration.tsconfig.json",
@@ -105,7 +106,7 @@
105106
"example:string-layouts": "cd examples/string-layouts && npm i --production && npm run build",
106107
"example:default-layout": "cd examples/default-layout && npm i --production && npm run build",
107108
"example:nested-dest": "cd examples/nested-dest && npm i --production && npm run build",
108-
"example-skip:uhtml-isomorphic": "cd examples/nested-dest && npm i --production && npm run build",
109+
"example:preact": "cd examples/preact && npm i --production && npm run build",
109110
"deps": "depcruise --exclude '^node_modules|^[a-zA-Z0-9\\_]+$' --output-type dot . | dot -T svg > dependencygraph.svg",
110111
"deps3d": "depcruise --exclude '^node_modules|^[a-zA-Z0-9\\_]+$' --output-type plugin:dependency-cruiser/sample-3d-reporter-plugin --output-to 3d-dependency-graph.html .",
111112
"start": "npm run watch"

0 commit comments

Comments
 (0)