concat javascript files into 1 main script file

to avoid loading too many javascript files
we concat everything into 1 main javascript file
then we minify it and use it for optimal speed and loading

Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>
jamesk-patch-1
Toshaan Bharvani 3 years ago
parent f042ba3787
commit 465a3bb14d

@ -50,20 +50,13 @@
<script src="https://registration.openpower.foundation/widget/v1.en.js" type="text/javascript" async></script> <script src="https://registration.openpower.foundation/widget/v1.en.js" type="text/javascript" async></script>
<script src="{{ "js/preload.js" | absURL }}"></script> <script src="{{ "js/preload.js" | absURL }}"></script>
{{ $mainjavascript := resources.Get "js/main.js" }} {{ $mainjavascript := resources.Get "js/main.js" }}
{{ $mainjs := $mainjavascript | resources.Minify }}
<script src="{{ $mainjs.RelPermalink }}"></script>
{{ $jqueryformjavascript := resources.Get "js/jquery.form.js" }} {{ $jqueryformjavascript := resources.Get "js/jquery.form.js" }}
{{ $jqueryformjs := $jqueryformjavascript | resources.Minify }}
<script src="{{ $jqueryformjs.RelPermalink }}"></script>
{{ $formjavascript := resources.Get "js/form.js" }} {{ $formjavascript := resources.Get "js/form.js" }}
{{ $formjs := $formjavascript | resources.Minify }}
<script src="{{ $formjs.RelPermalink }}"></script>
{{ $changelogjavascript := resources.Get "js/changelog.js" }} {{ $changelogjavascript := resources.Get "js/changelog.js" }}
{{ $changelogjs := $changelogjavascript | resources.Minify }}
<script src="{{ $changelogjs.RelPermalink }}"></script>
{{ $selectjavascript := resources.Get "js/select.js" }} {{ $selectjavascript := resources.Get "js/select.js" }}
{{ $selectjs := $selectjavascript | resources.Minify }} {{ $javascripts := slice $mainjavascript $jqueryformjavascript $formjavascript $changelogjavascript $selectjavascript | resources.Concat "js/scripts.js" }}
<script src="{{ $selectjs.RelPermalink }}"></script> {{ $javascript := $javascripts | resources.Minify }}
<script src="{{ $javascript.RelPermalink }}"></script>
{{ if .Site.Params.analytics.piwik }} {{ if .Site.Params.analytics.piwik }}
{{ partial "_analytics/piwik.html" . }} {{ partial "_analytics/piwik.html" . }}
{{ end }} {{ end }}

Loading…
Cancel
Save