script.html
This commit is contained in:
parent
6cd60f7559
commit
42f70cc8fb
1 changed files with 23 additions and 0 deletions
23
layouts/partials/resource_builders/script.html
Normal file
23
layouts/partials/resource_builders/script.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- $isModule := .module -}}
|
||||
|
||||
{{- $resource := .resource -}}
|
||||
{{ if $resource.resource }}
|
||||
{{ $resource = partial "resource_builders/build_js.html" $resource }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $resource }}
|
||||
{{ if eq hugo.Environment "development" }}
|
||||
<script
|
||||
{{- if $isModule }} type="module" {{ end -}}
|
||||
src="{{ .RelPermalink }}">
|
||||
</script>
|
||||
{{ else }}
|
||||
<script
|
||||
{{- if $isModule }} type="module" {{ end -}}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{- with .Data.Integrity }} integrity="{{ . }}" {{ end -}}
|
||||
crossorigin="anonymous"
|
||||
{{- "" -}}>
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue