diff options
author | Thibaud LeprĂȘtre <thibaud.lepretre@gmail.com> | 2018-08-26 17:16:30 +0300 |
---|---|---|
committer | Thibaud LeprĂȘtre <thibaud.lepretre@gmail.com> | 2018-08-26 17:16:30 +0300 |
commit | f6339da62c5fbd902afc46bfc58b802a2d8f00be (patch) | |
tree | b7807d64962c8151e783f57f7c0a67e1b90c0af1 /layouts | |
parent | 7694e6ecc18b7879b2e2091519c24a345486c6d1 (diff) |
Fix script attr defer/async
On chrome you must not add `async=false` is not working properly to disable `async` instead you must no add attr
fixes #186
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/script.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/partials/script.html b/layouts/partials/script.html index e119947..6e3a652 100644 --- a/layouts/partials/script.html +++ b/layouts/partials/script.html @@ -12,7 +12,7 @@ <!--SCRIPTS END--> {{ range .Site.Params.customJS }} {{ if isset . "src" }} - <script{{ range $key, $value := . }} {{ if eq $key "src" }}{{ (printf "%s=\"%s\"" $key ($value | absURL)) | safeHTMLAttr }}{{ else }}{{ (printf "%s=\"%s\"" $key (string $value)) | safeHTMLAttr }}{{ end }}{{ end }}></script> + <script{{ range $key, $value := . }} {{ if eq $key "src" }}{{ (printf "%s=\"%s\"" $key ($value | absURL)) | safeHTMLAttr }}{{ else if and (in "async defer" $key) }}{{ if $value }}{{ (printf "%s" $key) | safeHTMLAttr }}{{ end }}{{ else }}{{ (printf "%s=\"%s\"" $key (string $value)) | safeHTMLAttr }}{{ end }}{{ end }}></script> {{ else }} <script src="{{ . | absURL }}"></script> {{ end }} |