Fix Tailwind asset build dropping all utility classes in Docker

The Dockerfile asset stage copied only static/src + vite.config.js, never
the HTML templates. Tailwind v4 generates CSS by scanning source files for
class usage, so with no templates present it emitted a stripped CSS with
zero utility classes — breaking layout and ballooning SVG icons (w-5/h-5
no longer applied) on deployed builds.

- main.css: add explicit @source directive for the templates dir so content
  detection no longer depends on the build CWD.
- Dockerfile: copy vergabe_teilnahme/templates into the assets stage so the
  @source path resolves at build time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-21 00:37:07 +02:00
parent 483a4dfd3b
commit e28739f8f1
2 changed files with 11 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY vite.config.js ./
COPY static/src ./static/src
# Tailwind v4 scans these for utility-class usage at build time. They must be
# present or the generated CSS omits every utility class (broken layout, giant
# SVG icons). Paths mirror the @source directive in static/src/main.css.
COPY vergabe_teilnahme/templates ./vergabe_teilnahme/templates
RUN npm run build
# Output: /build/static/dist/main.css

View File

@@ -1,5 +1,12 @@
@import "tailwindcss";
/* Explicit content sources. Without these, Tailwind's automatic detection
depends on the build CWD finding the templates — which fails in the Docker
asset stage (it only copies static/src), producing a CSS with no utility
classes and badly oversized SVG icons. Keep these paths in sync with the
template dirs copied in the Dockerfile `assets` stage. */
@source "../../vergabe_teilnahme/templates";
@theme {
--color-brand-50: #f0f4ff;
--color-brand-100: #dce7ff;