feat(Tailwind): add support for community blox

This commit is contained in:
George Cushen committed 2024-04-20 22:45:32 +01:00
1 parent ab18989a41
commit 11a51f8e9f
2 files changed
+16 -1

No files matched your search

@@ -11,7 +11,12 @@
{{ end }}
{{ $block_path := printf "blox/%s.html" $block_type }}
{{ if not (templates.Exists (printf "partials/%s" $block_path)) }}
{{ errorf "%s uses a `%s` block but the `%s` block was not found at `layouts/partials/%s`" $block.File.Path $block_type $block_type $block_path }}
{{ $block_path_community := printf "blox/community/%s.html" $block_type }}
{{ if not (templates.Exists (printf "partials/%s" $block_path_community)) }}
{{ errorf "%s uses a `%s` blox but the `%s` blox was not found. Check the name of the blox and try again. For a custom or community blox, upload it first to `hugo-blox/blox/community/%s.html`. For an All Access blox, upload it first to `hugo-blox/blox/all-access/%s.html`" $page.File.Path $block_type $block_type $block_type $block_type }}
{{ else }}
{{ $block_path = $block_path_community }}
{{ end }}
{{ end }}
{{/* Mermaid block: Workaround to make Hugo's .Page.Store.Set cascade up to the parent of headless pages */}}
@@ -69,6 +69,16 @@
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
{{ end }}
{{/* Load community blox styles */}}
{{ $hb_community_styles := resources.Match "dist/community/blox/**.css" }}
{{ with $hb_community_styles }}
{{ $hb_community_styles = $hb_community_styles | resources.Concat "css/community-hugo-blox.css" }}
{{- if hugo.IsProduction -}}
{{- $hb_community_styles = $hb_community_styles | minify | fingerprint "sha256" -}}
{{- end -}}
<link href="{{ $hb_community_styles.RelPermalink }}" rel="stylesheet" />
{{ end }}
{{ if fileExists "assets/css/custom.css" }}
{{ $styles := resources.Get "css/custom.css" | minify | fingerprint "sha256" }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />