Skip to content

Commit 9b07e67

Browse files
committed
fix: fresh updates
1 parent 0bdd610 commit 9b07e67

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

deno.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@
4444
"source",
4545
"body",
4646
"html",
47-
"head"
47+
"head",
48+
"title",
49+
"meta",
50+
"script",
51+
"link",
52+
"style",
53+
"base",
54+
"noscript",
55+
"template"
4856
]
4957
}
5058
}

deno.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#!/usr/bin/env -S deno run -A --watch=static/,routes/
22
import { tailwind } from "@pakornv/fresh-plugin-tailwindcss";
33
import { Builder } from "fresh/dev";
4-
import { app } from "./main.ts";
54

65
const builder = new Builder();
7-
tailwind(builder, app);
6+
87
if (Deno.args.includes("build")) {
9-
await builder.build(app);
8+
await builder.build();
109
} else {
11-
await builder.listen(app);
10+
await builder.listen(async () => {
11+
const { app } = await import("./main.ts");
12+
tailwind(builder, app);
13+
return app;
14+
});
1215
}

main.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
import { App, fsRoutes, staticFiles } from "fresh";
1+
import { App, staticFiles } from "fresh";
22
import { type State } from "./utils.ts";
33
import "jsr:@std/dotenv/load";
4-
export const app = new App<State>();
54

6-
app.use(staticFiles());
7-
8-
app.get("/docs", () => {
9-
return new Response(null, {
10-
status: 302,
11-
headers: {
12-
Location: "/docs/index",
13-
},
14-
});
15-
});
16-
17-
await fsRoutes(app, {
18-
loadIsland: (path) => import(`./islands/${path}`),
19-
loadRoute: (path) => import(`./routes/${path}`),
20-
});
5+
export const app = new App<State>()
6+
.use(staticFiles())
7+
.get("/docs", () => {
8+
return new Response(null, {
9+
status: 302,
10+
headers: {
11+
Location: "/docs/index",
12+
},
13+
});
14+
})
15+
.fsRoutes();
2116

2217
if (import.meta.main) {
2318
await app.listen();

0 commit comments

Comments
 (0)