diff --git a/dev_server.ts b/dev_server.ts index fcafaf9..4250307 100644 --- a/dev_server.ts +++ b/dev_server.ts @@ -84,10 +84,10 @@ Deno.serve({ port }, async (req: Request) => { const watcher = Deno.watchFs("."); for await (const event of watcher) { if (event.kind === "modify") { - console.log("reload", event.paths); for (const ws of sockets) { if (ws.readyState === WebSocket.OPEN) { ws.send("reload"); + continue; } } } diff --git a/scaffold.ts b/scaffold.ts new file mode 100644 index 0000000..a001909 --- /dev/null +++ b/scaffold.ts @@ -0,0 +1,31 @@ +import { resolve, basename } from "https://deno.land/std/path/mod.ts"; + +const hostDir = "./scaffold/"; + +const filePaths = [ + "index.html", + "app.js", +]; + + +for (const filePath of filePaths) +{ + // Resolve the file path relative to the script's directory + const fileUrl = import.meta.resolve(hostDir + filePath); + + // Determine the destination path in the current working directory + const destinationPath = resolve(Deno.cwd(), basename(filePath)); + + console.log(`Downloading ${fileUrl} to ${destinationPath}`); + try { + const response = await fetch(fileUrl); + if (!response.ok) { + throw new Error(`Failed to fetch ${fileUrl}: ${response.statusText}`); + } + const fileData = await response.arrayBuffer(); + await Deno.writeFile(destinationPath, new Uint8Array(fileData)); + console.log(`Successfully downloaded ${filePath}`); + } catch (error) { + console.error(`Error downloading ${filePath}:`, error); + } +} \ No newline at end of file diff --git a/scaffold/app.js b/scaffold/app.js new file mode 100644 index 0000000..d815983 --- /dev/null +++ b/scaffold/app.js @@ -0,0 +1,47 @@ +const {DOM} = Gale({ + Button: { + padding: "20px", + background: "orange", + ".Inner": { + fontSize: "10rem" + } + }, + Outline: { + border: "2px solid orange" + }, + Window:{ + height: "100vh", + border: "2px solid black", + display: "flex", + flexDirection: "row", + alignItems: "end", + justifyContent: "center", + gap: "10px" + }, + Ability:{ + width: "50px", + height: "50px", + background: "red", + transition: "all 0.4s", + ":hover":{ + transform:"scale(1.1)" + } + }, + Orange:{ + background:"orange" + } +}); + + + +const UI =()=> +{ + return DOM.div.Window( + DOM.div.Ability(), + DOM.div.Ability(), + DOM.div.Ability(), + DOM.div.Ability.Orange(), + ) +} + +van.add(document.body, UI()); \ No newline at end of file diff --git a/_index.html b/scaffold/index.html similarity index 100% rename from _index.html rename to scaffold/index.html