Allow the Page's resources front matter to control whether a JS script is imported as a module
resources: - src: script.js params: is_module: <true|false>
This commit is contained in:
parent
7b9cb6bf73
commit
55781cd599
1 changed files with 2 additions and 1 deletions
|
@ -57,7 +57,8 @@
|
|||
{{ end }}
|
||||
|
||||
{{ range $script := .Resources.Match "*.js" }}
|
||||
<script defer type="module" src="{{ $script.Permalink | relURL }}"></script>
|
||||
{{ $isModule := default true $script.Params.is_module }}
|
||||
<script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
|
||||
{{ end }}
|
||||
|
||||
<!-- Misc -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue