build: move generated assets to dist

This commit is contained in:
2026-04-15 00:26:50 +02:00
parent 7a48f66a73
commit 90c80b9d1e
7 changed files with 18 additions and 14 deletions

View File

@@ -32,6 +32,10 @@ func NewRouter(cfg Config) http.Handler {
fs := http.FileServer(http.Dir("./static"))
mux.Handle("/static/", http.StripPrefix("/static/", fs))
// Serve built frontend assets
dist := http.FileServer(http.Dir("./dist"))
mux.Handle("/dist/", http.StripPrefix("/dist/", dist))
mux.HandleFunc("/", animeHandler.HandleCatalog)
mux.HandleFunc("/discover", animeHandler.HandleDiscover)
mux.HandleFunc("/notifications", animeHandler.HandleNotifications)

View File

@@ -10,12 +10,12 @@ templ Layout(title string, showHeader bool) {
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ title }</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg"/>
<link rel="stylesheet" href="/static/tailwind.css"/>
<link rel="stylesheet" href="/dist/tailwind.css"/>
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
<script src="/static/discover.js" defer></script>
<script src="/static/anime.js" defer></script>
<script src="/static/timezone.js" defer></script>
<script src="/static/auth.js" defer></script>
<script src="/dist/discover.js" defer></script>
<script src="/dist/anime.js" defer></script>
<script src="/dist/timezone.js" defer></script>
<script src="/dist/auth.js" defer></script>
</head>
<body class="min-h-screen bg-[var(--bg)] text-[var(--text)] font-[var(--font)] text-[14px] leading-[1.45]">
if showHeader {
@@ -48,7 +48,7 @@ templ Layout(title string, showHeader bool) {
}>
{ children... }
</main>
<script src="/static/search.js"></script>
<script src="/dist/search.js"></script>
</body>
</html>
}