https://github.com/kr1sp1n/deno-preact-ssr-example
server-side rendering with deno
https://github.com/kr1sp1n/deno-preact-ssr-example
deno example preact ssr static-site-generator
Last synced: 2 months ago
JSON representation
server-side rendering with deno
- Host: GitHub
- URL: https://github.com/kr1sp1n/deno-preact-ssr-example
- Owner: kr1sp1n
- Created: 2020-06-15T22:41:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-22T07:19:46.000Z (almost 5 years ago)
- Last Synced: 2025-01-30T23:30:57.999Z (4 months ago)
- Topics: deno, example, preact, ssr, static-site-generator
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deno-preact-ssr-example
Use deno as a static site generator by rendering preact app to a string.
The data is delivered by the server as ES Module and fetched in `render.js` in order to pass it to the preact app as props.
Furthermore `htm` is used as alternative to JSX and `jss` is used as CSS-in-JS framework.1. Start server on port 8000:
```bash
deno run --allow-net --allow-read --unstable src/server.js
```2. Render html pages to `dist` dir:
```bash
deno run --unstable --allow-read --allow-write src/render.js
```3. Open the `dist/index.html` with any browser.
4. Change `data.json` and render again by reloading only `http://localhost:8000/data.js`:
```bash
deno run --unstable --allow-read --allow-write --reload=http://localhost:8000/data.js src/render.js
```