Files
bridget/layouts/partials/plugin/style.html
Sped0n 72b830def9 refactor: remove multilingual support and language-specific fonts
Simplify to Geist font family for all languages. Update README, SCSS,
partials, and config. Fix style template execution order.

Signed-off-by: Sped0n <hi@sped0n.com>
2025-11-12 00:10:06 +08:00

63 lines
2.0 KiB
HTML

{{- if strings.HasPrefix .Source "<link" -}}
{{- safeHTML .Source -}}
{{- else -}}
{{- $href := .Source -}}
{{- $integrity := .Integrity -}}
{{- $resource := 0 -}}
{{- if $href | and (not (urls.Parse $href).Host) -}}
{{- $resource = resources.Get $href -}}
{{- end -}}
{{- with .Content -}}
{{- $resource = resources.FromString $.Path . -}}
{{- end -}}
{{- if $resource -}}
{{- with .ToCSS -}}
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
{{- $resource = $resource | toCSS $options -}}
{{- end -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- end -}}
{{- if or .Minify .Inline -}}
{{- $resource = $resource | minify -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- end -}}
{{- $href = $resource.RelPermalink -}}
{{- end -}}
{{- with .Link -}}
{{- $href = . -}}
{{- end -}}
{{- if .Inline -}}
<style>{{- $resource.Content | safeCSS -}}</style>
{{- else if .Defer -}}
<link
rel="preload"
as="style"
onload="this.onload=null;this.rel='stylesheet'"
href="{{ $href }}"
{{ if .Crossorigin }}crossorigin="anonymous"{{ end }}{{ with $integrity }}
integrity="{{ . }}"
{{ end }}{{ with .Attr }}{{ . | safeHTMLAttr }}{{ end }}
/>
<noscript
><link
rel="stylesheet"
href="{{ $href }}"
{{ if .Crossorigin }}crossorigin="anonymous"{{ end }}{{ with $integrity }}
integrity="{{ . }}"
{{ end }}{{ with .Attr }}{{ . | safeHTMLAttr }}{{ end }}
/></noscript>
{{- else -}}
<link
rel="stylesheet"
href="{{ $href }}"
{{ if .Crossorigin }}crossorigin="anonymous"{{ end }}{{ with $integrity }}
integrity="{{ . }}"
{{ end }}{{ with .Attr }}{{ . | safeHTMLAttr }}{{ end }}
/>
{{- end -}}
{{- end -}}