From 363810024ba3b9c16274f3b76f527ae0d13bbf7a Mon Sep 17 00:00:00 2001 From: lilsus Date: Thu, 16 Jul 2026 06:50:13 +0300 Subject: [PATCH] fix: pin Tailwind config path + absolute content globs (cwd-independent PostCSS for CI) --- tailwind.config.js | 89 +++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/tailwind.config.js b/tailwind.config.js index 18802b1..527bb2a 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,41 +1,48 @@ -/** - * Tailwind CSS 3.x configuration. - * - * Brand colours are wired to CSS custom properties that Hugo injects into - * :root from data/brand.yaml (see assets/css/main.css). This means utility - * classes like `bg-primary` / `text-primary` automatically reflect the brand - * without any template edits — change data/brand.yaml and rebuild. - */ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [ - "./layouts/**/*.html", - "./content/**/*.{html,md}", - ], - theme: { - extend: { - colors: { - // Mapped to RGB-channel CSS vars injected from data/brand.yaml so that - // Tailwind opacity modifiers (e.g. bg-primary/10) work correctly. - primary: "rgb(var(--brand-primary-rgb) / )", - secondary: "rgb(var(--brand-secondary-rgb) / )", - "primary-contrast": "rgb(var(--brand-primary-contrast-rgb) / )", - }, - fontFamily: { - sans: [ - "system-ui", - "-apple-system", - "Segoe UI", - "Roboto", - "Helvetica", - "Arial", - "sans-serif", - ], - }, - maxWidth: { - prose: "72ch", - }, - }, - }, - plugins: [], -}; +/** + * Tailwind CSS 3.x configuration. + * + * Brand colours are wired to CSS custom properties that Hugo injects into + * :root from data/brand.yaml (see assets/css/main.css). This means utility + * classes like `bg-primary` / `text-primary` automatically reflect the brand + * without any template edits — change data/brand.yaml and rebuild. + */ +const path = require("path"); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + // Resolve content globs absolute to THIS config file's directory so Tailwind + // scans the right files regardless of the process working directory. Hugo's + // PostCSS pipeline (css.PostCSS) does not always run with cwd = project root + // (notably in CI), and relative globs would then match nothing — producing + // empty CSS and "class does not exist" errors for @apply'd utilities. + content: [ + path.join(__dirname, "layouts/**/*.html"), + path.join(__dirname, "content/**/*.{html,md}"), + ], + theme: { + extend: { + colors: { + // Mapped to RGB-channel CSS vars injected from data/brand.yaml so that + // Tailwind opacity modifiers (e.g. bg-primary/10) work correctly. + primary: "rgb(var(--brand-primary-rgb) / )", + secondary: "rgb(var(--brand-secondary-rgb) / )", + "primary-contrast": "rgb(var(--brand-primary-contrast-rgb) / )", + }, + fontFamily: { + sans: [ + "system-ui", + "-apple-system", + "Segoe UI", + "Roboto", + "Helvetica", + "Arial", + "sans-serif", + ], + }, + maxWidth: { + prose: "72ch", + }, + }, + }, + plugins: [], +};