feat: integrate tailwind v4 and daisyui packages with local css build pipeline
This commit is contained in:
19
src/app.js
19
src/app.js
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
const { randomUUID } = require("node:crypto");
|
||||
const fs = require("node:fs/promises");
|
||||
const pathLib = require("node:path");
|
||||
const { XArtAudioEngine } = require("./lib/engine");
|
||||
const { verifySignature } = require("./lib/signature");
|
||||
const {
|
||||
@@ -38,6 +40,8 @@ const { createStorageAdapter } = require("./integrations/storage-client");
|
||||
const { createXAdapter } = require("./integrations/x-client");
|
||||
const { createAudioGenerationService } = require("./services/audio-generation");
|
||||
|
||||
const STYLESHEET_PATH = pathLib.join(__dirname, "public", "styles.css");
|
||||
|
||||
function sanitizeReturnTo(value, fallback = "/app") {
|
||||
if (!value || typeof value !== "string") {
|
||||
return fallback;
|
||||
@@ -310,6 +314,21 @@ function buildApp({
|
||||
);
|
||||
}
|
||||
|
||||
if (method === "GET" && path === "/assets/styles.css") {
|
||||
try {
|
||||
const css = await fs.readFile(STYLESHEET_PATH, "utf8");
|
||||
return text(200, css, "text/css; charset=utf-8", {
|
||||
"cache-control": "public, max-age=3600",
|
||||
});
|
||||
} catch {
|
||||
return text(
|
||||
503,
|
||||
"/* stylesheet not built yet; run `bun run build:css` */",
|
||||
"text/css; charset=utf-8",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (method === "GET" && path === "/") {
|
||||
return html(200, renderLandingPage({ authenticated: Boolean(userId), userId }));
|
||||
}
|
||||
|
||||
5
src/styles/app.css
Normal file
5
src/styles/app.css
Normal file
@@ -0,0 +1,5 @@
|
||||
@import "tailwindcss";
|
||||
@plugin "daisyui" {
|
||||
themes: light --default;
|
||||
logs: false;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ function shell({ title, content, compact = false }) {
|
||||
<title>${escapeHtml(title)}</title>
|
||||
<meta name="theme-color" content="#0f172a" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/daisyui@5/dist/full.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/assets/styles.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body class="min-h-screen bg-slate-950 text-slate-100">
|
||||
<div class="fixed inset-0 -z-10 overflow-hidden">
|
||||
|
||||
Reference in New Issue
Block a user