Include Railroad.js files in <head>
This commit is contained in:
parent
4c1baa2b6d
commit
a897f476e6
3 changed files with 22 additions and 6 deletions
|
@ -19,6 +19,9 @@
|
|||
{{ if or (eq .Kind "list") (eq .Kind "term") }}
|
||||
<link rel="preload stylesheet" as="style" href="/styles/list.css">
|
||||
{{ end }}
|
||||
{{ if and .IsPage (.Page.Scratch.Get "includes_railroad_diagram") }}
|
||||
<link rel="preload stylesheet" as="style" href="{{ `styles/railroad.css` | absURL }}">
|
||||
{{ end }}
|
||||
{{ range $stylesheet := .Resources.Match "*.css" }}
|
||||
<link rel="preload stylesheet" as="style" href="{{ $stylesheet.Permalink }}">
|
||||
{{ end }}
|
||||
|
@ -44,8 +47,8 @@
|
|||
{{ end }}
|
||||
|
||||
{{ if and .IsPage (.Page.Scratch.Get "includes_railroad_diagram") }}
|
||||
<script defer src="{{ `scripts/railroad.js` | absURL }}"></script>
|
||||
<script defer src="{{ `scripts/railroad-utils.js` | absURL }}"></script>
|
||||
<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") }}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{{ $id := .Get "id" }}
|
||||
{{ .Page.Scratch.Set "includes_railroad_diagram" true }}
|
||||
<div class="centered">
|
||||
<figure class="railroad-diagram" {{ if $id }}id="{{ $id }}"{{ end }}></figure>
|
||||
</div>
|
||||
<script defer type="module">
|
||||
import { railroadDiagram } from {{ `/scripts/railroad-utils.js` | relURL }};
|
||||
railroadDiagram(rr => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue