Merge pull request #57 from Junyi-99/feat-experimental-config

add: added error message when customCSS not exist
This commit is contained in:
Junyi 2024-06-14 15:31:36 +08:00 committed by GitHub
commit fbd7b4c939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,9 +59,18 @@
{{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }} {{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }}
{{ range site.Params.customCSS }} {{ range site.Params.customCSS }}
{{ with resources.Get . | toCSS $opts | minify | fingerprint }} {{ $r := "" }}
{{ with resources.Get . }}
{{ $r = . }}
{{ else }}
{{ errorf "error: You defined customCSS, but %s was not found, please check your config." . }}
{{ end }}
{{ if $r}}
{{ with $r | toCSS $opts | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
{{ if site.Params.isso.enabled }} {{/* TODO: maybe we can remove it */}} {{ if site.Params.isso.enabled }} {{/* TODO: maybe we can remove it */}}