Skip to content
Snippets Groups Projects
Commit 49b1e498 authored by alexisben's avatar alexisben
Browse files

call splide js only when needed

parent ab68e1a9
No related branches found
No related tags found
No related merge requests found
import './vendors/lightbox';
import './vendors/carousel';
import './theme/';
{{ $isLeafletNeeded := false }}
{{ $isSplideNeed := false }}
{{ if .Params.blocks }}
{{ range .Params.blocks }}
......@@ -9,9 +10,22 @@
{{ end }}
{{ end }}
{{ end }}
{{ if eq .template "gallery"}}
{{ with .data }}
{{ if eq .layout "carousel" }}
{{ $isSplideNeed = true }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if $isSplideNeed }}
{{ $splide_js := resources.Get "js/vendors/carousel.js" | js.Build (dict "minify" hugo.IsProduction) | fingerprint }}
<script src="{{ $splide_js.RelPermalink }}" integrity="{{ $splide_js.Data.Integrity }}"></script>
{{ end }}
{{ if $isLeafletNeeded }}
<!-- CSS -->
{{- $cssOpts := (dict
......@@ -27,7 +41,6 @@
{{ $leaflet_js := resources.Get "js/vendors/leaflet.js" | js.Build (dict "minify" hugo.IsProduction) | fingerprint }}
<script src="{{ $leaflet_js.RelPermalink }}" integrity="{{ $leaflet_js.Data.Integrity }}"></script>
{{ end }}
{{ $js := resources.Get "js/main.js" | js.Build (dict "minify" hugo.IsProduction) | fingerprint }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment