Skip to content

Commit 41ec3b3

Browse files
Merge pull request #36 from denoland/fresh-example
Add Fresh example
2 parents 1ca6b52 + 3015431 commit 41ec3b3

File tree

15 files changed

+692
-0
lines changed

15 files changed

+692
-0
lines changed

with-fresh/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# dotenv environment variable files
2+
.env
3+
.env.development.local
4+
.env.test.local
5+
.env.production.local
6+
.env.local
7+
8+
# Fresh build directory
9+
_fresh/
10+
# npm + other dependencies
11+
node_modules/
12+
vendor/
13+

with-fresh/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Fresh project
2+
3+
Your new Fresh project is ready to go. You can follow the Fresh "Getting
4+
Started" guide here: https://fresh.deno.dev/docs/getting-started
5+
6+
### Usage
7+
8+
Make sure to install Deno:
9+
https://docs.deno.com/runtime/getting_started/installation
10+
11+
Then start the project in development mode:
12+
13+
```
14+
deno task dev
15+
```
16+
17+
This will watch the project directory and restart as necessary.
18+
19+
20+
### Clone and deploy
21+
22+
Deploy your own version of this example with a couple of clicks
23+
24+
[![Deploy on Deno](https://deno.com/button)](https://app.deno.com/new?clone=https://github.com/denoland/examples&path=with-fresh)

with-fresh/components/Button.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { ComponentChildren } from "preact";
2+
3+
export interface ButtonProps {
4+
id?: string;
5+
onClick?: () => void;
6+
children?: ComponentChildren;
7+
disabled?: boolean;
8+
}
9+
10+
export function Button(props: ButtonProps) {
11+
return (
12+
<button
13+
{...props}
14+
class="px-2 py-1 border-gray-500 border-2 rounded-sm bg-white hover:bg-gray-200 transition-colors"
15+
/>
16+
);
17+
}

with-fresh/deno.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"nodeModulesDir": "auto",
3+
"tasks": {
4+
"check": "deno fmt --check . && deno lint . && deno check",
5+
"dev": "deno run -A --watch=static/,routes/ dev.ts",
6+
"build": "deno run -A dev.ts build",
7+
"start": "deno serve -A _fresh/server.js",
8+
"update": "deno run -A -r jsr:@fresh/update ."
9+
},
10+
"lint": {
11+
"rules": {
12+
"tags": [
13+
"fresh",
14+
"recommended"
15+
]
16+
}
17+
},
18+
"exclude": [
19+
"**/_fresh/*"
20+
],
21+
"imports": {
22+
"fresh": "jsr:@fresh/core@^2.0.0-alpha.60",
23+
"preact": "npm:preact@^10.27.1",
24+
"@preact/signals": "npm:@preact/signals@^2.3.1"
25+
},
26+
"compilerOptions": {
27+
"lib": [
28+
"dom",
29+
"dom.asynciterable",
30+
"dom.iterable",
31+
"deno.ns"
32+
],
33+
"jsx": "precompile",
34+
"jsxImportSource": "preact",
35+
"jsxPrecompileSkipElements": [
36+
"a",
37+
"img",
38+
"source",
39+
"body",
40+
"html",
41+
"head"
42+
]
43+
}
44+
}

0 commit comments

Comments
 (0)