Files
George Cushen 4fa40b91e2 feat(css): co-locate block CSS with auto-discovery via Tailwind pipeline
Move block-specific CSS from centralized assets/css/blox/ to co-located
style.css files within each block directory. The css.html partial now
auto-discovers style.css files from bundled and community blocks and
concatenates them into the Tailwind entry via resources.Concat, enabling
full @apply support while avoiding VFS path resolution issues.

Shared biography styles (avatar, ruby) are extracted to blox/shared/css/
and auto-included before per-block styles. Navbar CSS moves to
components/ as it's a framework-level concern. The separate community
CSS pipeline in site_head.html is removed — all block CSS now flows
through a single Tailwind entry point.
2026-03-27 04:15:49 +00:00

35 lines
1.4 KiB
HTML

{{/* HB Tailwind CSS v4 Processing with Hugo's Native Function */}}
{{ with resources.Get "css/main.css" }}
{{/* Build dynamic @source list and prepend it before main.css */}}
{{ $dynamic_sources_str := partial "tailwind_sources.html" . }}
{{ $dynamic_sources_res := resources.FromString "css/_dynamic_sources.css" $dynamic_sources_str }}
{{ $main_css := . }}
{{ $entry_parts := slice $dynamic_sources_res $main_css }}
{{/* Auto-discover co-located block CSS: shared utilities first, then per-block styles */}}
{{ range resources.Match "css/hbx/blocks/shared/**/*.css" }}
{{ $entry_parts = $entry_parts | append . }}
{{ end }}
{{ range resources.Match "css/hbx/blocks/**/style.css" }}
{{ $entry_parts = $entry_parts | append . }}
{{ end }}
{{/* Community block CSS (mounted by templates into dist/community/blox/) */}}
{{ range resources.Match "dist/community/blox/**/*.css" }}
{{ $entry_parts = $entry_parts | append . }}
{{ end }}
{{ $entry := $entry_parts | resources.Concat "css/_entry.css" }}
{{ $opts := dict "minify" (not hugo.IsDevelopment) }}
{{ with $entry | css.TailwindCSS $opts }}
{{ if hugo.IsDevelopment }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{ else }}
{{ with . | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ end }}
{{ end }}
{{ end }}