feat(search): add local search (#231)

* feat(search): add local search

* docs: add docs for search
This commit is contained in:
Dillon
2020-04-15 15:46:50 +08:00
committed by GitHub
parent b6ce753ae7
commit 90184ca3e7
92 changed files with 4843 additions and 1214 deletions

View File

@@ -1,7 +1,25 @@
{{- $res := .resource -}}
{{- with .fingerprint -}}
{{- $res = $res | resources.Fingerprint . -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}" integrity="{{ $res.Data.Integrity }}">
{{- if strings.HasPrefix .source "<link" -}}
{{- safeHTML .source -}}
{{- else -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{- $href := .source -}}
{{- $integrity := .integrity -}}
{{- if strings.HasPrefix $href "http" | not -}}
{{- $res := resources.Get $href -}}
{{- with .template -}}
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
{{- end -}}
{{- with .toCSS -}}
{{- $options := . | merge (dict "outputStyle" "compressed" "enableSourceMap" true) -}}
{{- $res = $res | toCSS $options -}}
{{- end -}}
{{- if .minify -}}
{{- $res = $res | minify -}}
{{- end -}}
{{- with .fingerprint -}}
{{- $res = $res | fingerprint . -}}
{{- $integrity = $res.Data.Integrity -}}
{{- end -}}
{{- $href = $res.RelPermalink -}}
{{- end -}}
<link rel="stylesheet" href="{{ $href }}"{{ if .crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .attr }} {{ . | safeHTMLAttr }}{{ end }}>
{{- end -}}