Include p5 scripts if includes_p5_sketch is set in the page's .Scratch

Update the p5_sketch shortcode to set that value in .Scratch
This commit is contained in:
Eryn Wells 2022-08-16 09:15:35 -07:00
parent 14babf16eb
commit b495d84c64
2 changed files with 7 additions and 1 deletions

View file

@ -50,6 +50,11 @@
<script defer 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" }}
<script defer type="module" src="{{ $script.Permalink | relURL }}"></script>
{{ end }}