I’m attempting to use the example css.html
partial from the css.Tailwindcss documentation (as below) (this is my modified version):
{{ with (templates.Defer (dict "key" "global")) }}
{{ $theme := $.Site.Params.colorScheme | default "slate" }}
{{ with resources.Get (printf "css/%s.css" $theme) }}
{{/* with resources.Get "css/test.css" */}}
{{ $opts := dict
"minify" (not hugo.IsDevelopment)
"inlineImports" true
}}
{{ with . | 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 }}
{{ end }}
Now, I think I understand that because of templates.Defer
it doesn’t have access to the site parameters, etc? What do I need to do in order to reference them in this partial?
(the reason for doing this is to allow the theme user to set the color scheme)