diff options
author | de-souza <43355143+de-souza@users.noreply.github.com> | 2019-11-16 02:37:45 +0300 |
---|---|---|
committer | de-souza <43355143+de-souza@users.noreply.github.com> | 2019-11-16 02:37:45 +0300 |
commit | 905522e8747119f415032386800c8d6687762d01 (patch) | |
tree | 22ccbb2c150fd3c2c2de052b42e97472d5758ef3 /layouts/_default/baseof.html | |
parent | b601f30e38228e2f783bdd13fd249f69d1ee6e1b (diff) |
Add possibility to use site-wide custom CSS and JS
Diffstat (limited to 'layouts/_default/baseof.html')
-rw-r--r-- | layouts/_default/baseof.html | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d4e17f9..8c412ea 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -18,7 +18,18 @@ {{ range .AlternativeOutputFormats }} {{ printf "<link rel=%q type=%q href=%q title=%q>" .Rel .MediaType .Permalink site.Title | safeHTML }} {{ end }} - {{ resources.Get "css/base.tpl.css" | resources.ExecuteAsTemplate "css/base.css" . | minify | fingerprint | .Page.Scratch.SetInMap "css" "base" }} + {{ $basecss := resources.Get "css/base.tpl.css" | resources.ExecuteAsTemplate "css/base.css" . }} + {{ with site.Params.css }} + {{ $customcss := slice $basecss }} + {{ range . }}{{ $customcss = $customcss | append (readFile . | resources.FromString (printf "custom/%s" .)) }}{{ end }} + {{ $basecss = $customcss | resources.Concat "css/base.css" }} + {{ end }} + {{ $basecss | minify | fingerprint | .Page.Scratch.SetInMap "css" "base" }} + {{ with site.Params.js }} + {{ $customjs := slice }} + {{ range . }}{{ $customjs = $customjs | append (readFile . | resources.FromString (printf "custom/%s" .)) }}{{ end }} + {{ $customjs | resources.Concat "js/base.js" | minify | fingerprint | $.Page.Scratch.SetInMap "js" "base" }} + {{ end }} {{/* In the following block, Hugo is forced to stop and pre-render the content of the current page with all its shortcodes. Thanks to this |