Browse Source

add html plugin

C4illin 1 năm trước cách đây
mục cha
commit
b0c2dba1d6
6 tập tin đã thay đổi với 23 bổ sung2 xóa
  1. BIN
      bun.lockb
  2. 1 0
      package.json
  3. 4 2
      src/index.ts
  4. 15 0
      src/pages/index.html
  5. 3 0
      src/public/pico.lime.min.css
  6. 0 0
      src/public/style.css

BIN
bun.lockb


+ 1 - 0
package.json

@@ -6,6 +6,7 @@
     "dev": "bun run --watch src/index.ts"
   },
   "dependencies": {
+    "@elysiajs/html": "^1.0.2",
     "@elysiajs/static": "^1.0.2",
     "elysia": "latest"
   },

+ 4 - 2
src/index.ts

@@ -1,11 +1,13 @@
 import { Elysia } from "elysia";
 import { staticPlugin } from '@elysiajs/static'
+import { html } from '@elysiajs/html'
 
 const app = new Elysia()
+  .use(html())
   .use(staticPlugin({
-    assets: "../frontend/", prefix: "/"
+    assets: "src/public/", prefix: "/"
   }))
-  .get("/", () => Bun.file("../frontend/index.html"))
+  .get("/", () => Bun.file("src/pages/index.html"))
   .listen(3000);
 
 console.log(

+ 15 - 0
src/pages/index.html

@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>ConvertX</title>
+  <link rel="stylesheet" href="pico.lime.min.css">
+  <link rel="stylesheet" href="style.css">
+</head>
+<body>
+  <main class="container">
+    <h1>Hello world!</h1>
+  </main>
+</body>
+</html>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 0
src/public/pico.lime.min.css


+ 0 - 0
src/public/style.css


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác