🐛 Fix: the “type” attribute is unnecessary for JavaScript resources

The default `type` for `<script>` tags is `JavaScript`, so you don’t need to include the type for JS resources.
This commit is contained in:
Cell
2022-08-26 17:11:48 +08:00
parent 55e747e5f1
commit 2efcf947a7
7 changed files with 8 additions and 12 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
{{- if .Content -}}
<script type="text/javascript">
{{- .Content | safeJS -}}
</script>
<script>{{- .Content | safeJS -}}</script>
{{- else if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
{{- else -}}
@@ -22,6 +20,6 @@
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- end -}}
<script type="text/javascript" src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
<script src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
{{- end -}}
{{- end -}}