feat(tailwind): prevent error when using hugo new site

As unfortunately Hugo always triggers error even when using `with` statement with a non-safelisted `os.Getenv` var
This commit is contained in:
George Cushen 2024-06-01 19:27:12 +01:00
commit 2b11b7e9fb
4 changed files with 6 additions and 5 deletions

View file

@ -80,9 +80,10 @@ module:
security:
funcs:
getenv:
# Allow HUGO_ and HUGO_BLOX_ vars
- ^HUGO_
- ^WC_
- ^HB_
# Allow continuous integration vars
- ^CI$
outputFormats:
backlinks:
mediaType: application/json

View file

@ -6,7 +6,7 @@
{{ if eq .Type "landing" }}
{{ range $index, $block := .Params.sections }}
{{/* Do not show sections intended only for the demo site. */}}
{{ if or (not $block.demo) ($block.demo | and (eq (os.Getenv "WC_DEMO") "true")) }}
{{ if or (not $block.demo) ($block.demo | and (eq (os.Getenv "HUGO_BLOX_DEMO") "true")) }}
{{ $block_type := lower ($block.blox | default $block.block) | default "markdown" }}
{{ range $r := site.Data.blox_aliases.renames }}
{{ $block_type = cond (eq $block_type $r.old) $r.new $block_type }}

View file

@ -1,7 +1,7 @@
{{/* Load Hugo Blox */}}
{{ range $index, $block := .Params.sections }}
{{/* Do not show sections intended only for the demo site. */}}
{{ if or (not $block.demo) ($block.demo | and (eq (os.Getenv "WC_DEMO") "true")) }}
{{ if or (not $block.demo) ($block.demo | and (eq (os.Getenv "HUGO_BLOX_DEMO") "true")) }}
{{ partial "functions/parse_block_v2" (dict "page" $ "block" $block) }}
{{ end }}
{{ end }}

View file

@ -56,7 +56,7 @@
{{ end }}
{{/* Style */}}
{{ if ne (os.Getenv "WC_POSTCSS") "true" }}
{{ if ne (os.Getenv "HUGO_BLOX_POSTCSS") "true" }}
{{ $styles := resources.Get "dist/wc.min.css" }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
{{ else }}