Move scripts to the bottom of the body
This commit is contained in:
parent
fbacdb6694
commit
6f21bae492
2 changed files with 15 additions and 15 deletions
|
@ -10,6 +10,21 @@
|
||||||
{{ partial "footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
{{ if and .IsPage (.Page.Scratch.Get "includes_railroad_diagram") }}
|
||||||
|
<script defer type="module" src="{{ `scripts/railroad.js` | absURL }}"></script>
|
||||||
|
<script defer type="module" src="{{ `scripts/railroad-utils.js` | absURL }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if and .IsPage (.Page.Scratch.Get "includes_p5_sketch") }}
|
||||||
|
<script defer src="{{ `scripts/p5-1.4.1.min.js` | absURL }}"></script>
|
||||||
|
<script defer src="{{ `scripts/sketch-utils.js` | absURL }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range $script := .Resources.Match "*.js" }}
|
||||||
|
{{ $isModule := default true $script.Params.is_module }}
|
||||||
|
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const bodyClasses = document.body.classList;
|
const bodyClasses = document.body.classList;
|
||||||
const systemDarkModeMatch = window.matchMedia('(prefers-color-scheme: dark)');
|
const systemDarkModeMatch = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
|
@ -46,21 +46,6 @@
|
||||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink }}" title="{{ site.Title }}">
|
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink }}" title="{{ site.Title }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if and .IsPage (.Page.Scratch.Get "includes_railroad_diagram") }}
|
|
||||||
<script defer type="module" src="{{ `scripts/railroad.js` | absURL }}"></script>
|
|
||||||
<script defer type="module" src="{{ `scripts/railroad-utils.js` | absURL }}"></script>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if and .IsPage (.Page.Scratch.Get "includes_p5_sketch") }}
|
|
||||||
<script defer src="{{ `scripts/p5-1.4.1.min.js` | absURL }}"></script>
|
|
||||||
<script defer src="{{ `scripts/sketch-utils.js` | absURL }}"></script>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ range $script := .Resources.Match "*.js" }}
|
|
||||||
{{ $isModule := default true $script.Params.is_module }}
|
|
||||||
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<!-- Misc -->
|
<!-- Misc -->
|
||||||
{{ if or hugo.IsProduction (eq site.Params.env "production") }}
|
{{ if or hugo.IsProduction (eq site.Params.env "production") }}
|
||||||
<!---->
|
<!---->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue