From e9ec93a471d9a753db01b682e75c52b32adf16f2 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Thu, 18 Feb 2021 21:44:01 +0100 Subject: use LoveIt theme, self hosted --- .../layouts/partials/plugin/compatibility.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/LoveIt/layouts/partials/plugin/compatibility.html (limited to 'themes/LoveIt/layouts/partials/plugin/compatibility.html') diff --git a/themes/LoveIt/layouts/partials/plugin/compatibility.html b/themes/LoveIt/layouts/partials/plugin/compatibility.html new file mode 100644 index 0000000..b460f18 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/compatibility.html @@ -0,0 +1,22 @@ +{{- $compatibility := .Site.Params.compatibility | default dict -}} +{{- $cdn := .Scratch.Get "cdn" | default dict -}} +{{- $fingerprint := .Scratch.Get "fingerprint" -}} + +{{- /* Polyfill.io */ -}} +{{- if $compatibility.polyfill -}} + {{- $features := slice -}} + {{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}} + {{- range . -}} + {{- $features = $features | append . -}} + {{- end -}} + {{- end -}} + {{- with $features | uniq -}} + {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- end -}} +{{- end -}} + +{{- /* object-fit-images */ -}} +{{- if $compatibility.objectFit -}} + {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- end -}} -- cgit v1.2.3