mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 10:56:16 +01:00
fix(scripts): fix CDN not work bug
This commit is contained in:
parent
61250a0ae4
commit
a20700595d
1 changed files with 10 additions and 10 deletions
|
@ -35,17 +35,17 @@
|
|||
{{- $smooth_scroll | safeHTML -}}
|
||||
|
||||
{{- /* TypeIt https://github.com/alexmacarthur/typeit */ -}}
|
||||
{{- with .Scratch.Get "typeitMap" -}}
|
||||
{{- if .Scratch.Get "typeitMap" -}}
|
||||
{{- $typeit := "" -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and $.Site.Params.cdn.typeit_js -}}
|
||||
{{- $typeit = $.Site.Params.cdn.typeit_js -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js -}}
|
||||
{{- $typeit = .Site.Params.cdn.typeit_js -}}
|
||||
{{- else -}}
|
||||
{{- $res := resources.Get "js/lib/typeit/typeit.min.js" -}}
|
||||
{{- $typeit = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $typeit | safeHTML -}}
|
||||
{{- $typeitArr := slice -}}
|
||||
{{- range $key, $val := . -}}
|
||||
{{- range $key, $val := .Scratch.Get "typeitMap" -}}
|
||||
{{- $typeitArr = $typeitArr | append (slice $val) -}}
|
||||
{{- end -}}
|
||||
<script>
|
||||
|
@ -126,7 +126,7 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- /* mermaid https://github.com/knsv/mermaid */ -}}
|
||||
{{- with .Scratch.Get "mermaidMap" -}}
|
||||
{{- if .Scratch.Get "mermaidMap" -}}
|
||||
{{- $mermaid := "" -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.mermaid_js -}}
|
||||
{{- $mermaid = .Site.Params.cdn.mermaid_js -}}
|
||||
|
@ -138,7 +138,7 @@
|
|||
{{- $mermaid = delimit (slice $mermaid $mermaidInit) "" -}}
|
||||
{{- $mermaid | safeHTML -}}
|
||||
<script>
|
||||
{{- printf "window.mermaidMap=%s;" (jsonify .) | safeJS -}}
|
||||
{{- printf "window.mermaidMap=%s;" (jsonify .Scratch.Get "mermaidMap") | safeJS -}}
|
||||
</script>
|
||||
{{- end -}}
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- /* jQuery.countdown https://github.com/hilios/jQuery.countdown */ -}}
|
||||
{{- with .Scratch.Get "countdownMap" -}}
|
||||
{{- if .Scratch.Get "countdownMap" -}}
|
||||
{{- $countdown := "" -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js -}}
|
||||
{{- $countdown = .Site.Params.cdn.jquery_countdown_js -}}
|
||||
|
@ -184,14 +184,14 @@
|
|||
{{- end -}}
|
||||
{{- $countdown | safeHTML -}}
|
||||
<script>
|
||||
{{- printf "window.countdownMap=%s;" (jsonify .) | safeJS -}}
|
||||
{{- printf "window.countdownMap=%s;" (jsonify .Scratch.Get "countdownMap") | safeJS -}}
|
||||
</script>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* dev feature */ -}}
|
||||
{{- if .Params.dev -}}
|
||||
{{- /* ECharts https://github.com/apache/incubator-echarts */ -}}
|
||||
{{- with .Scratch.Get "echartsMap" -}}
|
||||
{{- if .Scratch.Get "echartsMap" -}}
|
||||
{{- $echarts_js := "" -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js -}}
|
||||
{{- $echarts_js = .Site.Params.cdn.echarts_js -}}
|
||||
|
@ -210,7 +210,7 @@
|
|||
{{- $echarts | safeHTML -}}
|
||||
<script>
|
||||
window.echartsMap = {
|
||||
{{- range $key, $var := . -}}
|
||||
{{- range $key, $var := .Scratch.Get "echartsMap" -}}
|
||||
{{- $key }}: {{ $var | safeJS -}},
|
||||
{{- end -}}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue