Skip to content

Commit 60c9364

Browse files
author
jesseagleboy
committed
reorganized folders and added build function
1 parent 899644b commit 60c9364

File tree

10 files changed

+27
-9
lines changed

10 files changed

+27
-9
lines changed

build.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import bunPluginTailwind from "bun-plugin-tailwind"
2+
import bunPluginSvelte from "bun-plugin-svelte"
3+
4+
Bun.build({
5+
entrypoints: ["src/index.html", "src/another-page.html"],
6+
outdir: "./dist",
7+
minify: true,
8+
splitting: true,
9+
sourcemap: "linked",
10+
naming: {
11+
entry: "[dir]/[name].[ext]", // Preserves original HTML names
12+
chunk: "assets/[name]-[hash].[ext]", // Unique chunks with hashes
13+
asset: "assets/[name]-[hash].[ext]", // Unique assets with hashes
14+
},
15+
plugins: [bunPluginTailwind, bunPluginSvelte],
16+
});

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"scripts": {
3-
"dev": "bun **/*.html"
3+
"dev": "bun src/**/*.html",
4+
"build": "bun build.ts",
5+
"preview": "bun run build; bunx serve dist"
46
},
57
"dependencies": {
68
"@preact/signals-react": "^3.0.1",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Another Page</title>
7-
<link rel="stylesheet" href="./styles.css">
8-
<script src="another.tsx" type="module" defer></script>
7+
<link rel="stylesheet" href="stylesheet/styles.css">
8+
<script src="./react/another.tsx" type="module" defer></script>
99
</head>
1010
<body class="prose p-4">
1111
<h4>This is another page</h4>

index.html renamed to src/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Bun Testing 1.2.3</title>
7-
<script src="index.tsx" type="module" defer></script>
8-
<script src="svelte.ts" type="module" defer></script>
9-
<link rel="stylesheet" href="./styles.css">
7+
<script src="./react/index.tsx" type="module" defer></script>
8+
<script src="./svelte/svelte.ts" type="module" defer></script>
9+
<link rel="stylesheet" href="stylesheet/styles.css">
1010
</head>
1111
<body class="prose p-4">
1212
<h3>This is a regular HTML setup</h3>

another.tsx renamed to src/react/another.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {createRoot} from 'react-dom/client';
2-
import {count} from "./store";
2+
import {count} from "../store";
33

44
function Another() {
55
return (

index.tsx renamed to src/react/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createRoot } from "react-dom/client";
2-
import {count} from "./store";
2+
import {count} from "../store";
33
function App() {
44
return (
55
<article className="p-1.5">
File renamed without changes.
File renamed without changes.

App.svelte renamed to src/svelte/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { count } from "./store.ts";
2+
import { count } from "../store.ts";
33
// biome-ignore lint/style/useConst: <explanation>
44
let name = $state("Jesse");
55
</script>
File renamed without changes.

0 commit comments

Comments
 (0)