Przeglądaj źródła

custom css, js support

zzossig 5 lat temu
rodzic
commit
9ae4e13608

+ 10 - 0
layouts/partials/head/scripts.html

@@ -1,3 +1,13 @@
+{{ if .Site.Params.custom_js }}
+{{ range .Site.Params.custom_js }}
+  {{ $custom_template := resources.Get . }}
+  {{ if $custom_template }}
+    {{ $custom_js := $custom_template | resources.Minify | resources.Fingerprint }}
+    <script defer src="{{ $custom_js.RelPermalink }}"></script>
+  {{ end }}
+{{ end }}
+{{ end }}
+
 {{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
 <script src="{{ $enquire.RelPermalink }}"></script>
 {{ $fuse := resources.Get "js/fuse.min.js" | resources.Fingerprint }}

+ 10 - 0
layouts/partials/head/styles.html

@@ -2,3 +2,13 @@
 {{ $main_template := resources.Get "sass/main.scss" }}
 {{ $main_style := $main_template | resources.ExecuteAsTemplate "main_parsed.scss" . | toCSS $main_options | resources.Minify }}
 <link rel="stylesheet" href="{{ $main_style.RelPermalink }}">
+
+{{ if .Site.Params.custom_css }}
+{{ range .Site.Params.custom_css }}
+  {{ $custom_template := resources.Get . }}
+  {{ if $custom_template }}
+    {{ $custom_style := $custom_template | resources.ToCSS | resources.Minify }}
+    <link rel="stylesheet" href="{{ $custom_style.RelPermalink }}">
+  {{ end }}
+{{ end }}
+{{ end }}