{{- /* Robust CSS loader: externe Links direkt, lokale Ressourcen sammeln, SCSS bauen, dann bündeln */ -}}
{{- $bundleList := slice -}}
{{- /* 1) Plugins aus params: externe -> , lokale -> sammeln */ -}}
{{- $plugins := site.Params.plugins.css | default (slice) -}}
{{- range $plugins }}
{{- $link := .link | default "" -}}
{{- if $link -}}
{{- if findRE `^https?://` $link -}}
{{- else -}}
{{- with (resources.Get $link) -}}
{{- $bundleList = $bundleList | append . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* 2) SCSS bauen (falls vorhanden) und hinzufügen */ -}}
{{- with (resources.Get "scss/style.scss") -}}
{{- $css := . | resources.ExecuteAsTemplate "scss/style.scss" $ | toCSS (dict "targetPath" "css/style.css") -}}
{{- $bundleList = $bundleList | append $css -}}
{{- end -}}
{{- /* 3) Bündeln + minify + fingerprint, sofern wir was haben */ -}}
{{- if gt (len $bundleList) 0 -}}
{{- $bundle := $bundleList | resources.Concat "css/bundle.css" | minify | fingerprint "sha512" -}}
{{- else -}}
{{- /* Fallback: statische CSS falls vorhanden/gewünscht */ -}}
{{- end -}}