fix: include blog models in Tailwind content scan for tag colours #28

Merged
mark merged 1 commits from fix/tag-colour-safelist into main 2026-03-02 16:29:56 +00:00
Owner

Problem

Tags on blog posts render as white text on a white background instead of showing their assigned colours (cyan/pink/neutral).

Root Cause

Tag colour classes (bg-cyan-100, text-cyan-900, bg-pink-100, text-pink-900, bg-zinc-100, text-zinc-800) are generated dynamically in TagMetadata.get_css_classes() in apps/blog/models.py. The Tailwind content array only scanned HTML templates, so the JIT compiler never saw these classes and purged them from the CSS build.

Fix

Added apps/blog/models.py to the Tailwind content sources in tailwind.config.js. The scanner now detects the colour class strings in the Python source and retains them in the built stylesheet.

Verified all six tag colour classes are present in the built styles.css. All tests pass.

## Problem Tags on blog posts render as white text on a white background instead of showing their assigned colours (cyan/pink/neutral). ## Root Cause Tag colour classes (`bg-cyan-100`, `text-cyan-900`, `bg-pink-100`, `text-pink-900`, `bg-zinc-100`, `text-zinc-800`) are generated dynamically in `TagMetadata.get_css_classes()` in `apps/blog/models.py`. The Tailwind `content` array only scanned HTML templates, so the JIT compiler never saw these classes and purged them from the CSS build. ## Fix Added `apps/blog/models.py` to the Tailwind content sources in `tailwind.config.js`. The scanner now detects the colour class strings in the Python source and retains them in the built stylesheet. Verified all six tag colour classes are present in the built `styles.css`. All tests pass.
mark added 1 commit 2026-03-02 16:28:23 +00:00
fix: include blog models in Tailwind content scan for tag colours
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m11s
CI / ci (pull_request) Successful in 1m16s
6bae864c1e
Tag colour classes (bg-cyan-100, text-cyan-900, etc.) are generated
dynamically in TagMetadata.get_css_classes() in apps/blog/models.py.
Tailwind's content scanner only covered HTML templates, so these classes
were purged from the CSS build — rendering tags as white-on-white.

Add apps/blog/models.py to the Tailwind content array so the JIT
compiler detects and retains the dynamic colour classes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mark merged commit 43e7068110 into main 2026-03-02 16:29:56 +00:00
mark deleted branch fix/tag-colour-safelist 2026-03-02 16:29:56 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nohype/main-site#28