Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script defer/async attribute fails to render #2

Closed
h-enk opened this issue Jan 6, 2023 · 1 comment
Closed

Script defer/async attribute fails to render #2

h-enk opened this issue Jan 6, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@h-enk
Copy link
Member

h-enk commented Jan 6, 2023

See: https://github.com/h-enk/hyas-core/blob/main/layouts/partials/footer/esbuild.html#L77-L79

Issue

<script {{ with $load }}{{ . }}{{ end }} 
src="{{- $js.RelPermalink -}}"
integrity="{{- $js.Data.Integrity -}}"></script>

Gets rendered as — for example:

<script ZgotmplZ 
src="/js/bootstrap.cab6a9fd760df551eb4f2d5b061e92f9d3948ab3e72c6ba4621a91ac01c55ca1.js"
integrity="sha256-yrap/XYN9VHrTy1bBh6S&#43;dOUirPnLGukYhqRrAHFXKE="></script><script ZgotmplZ 
src="/js/app.1b957aaec1272a032f2d481858c1074c37a3f32ee071717c5b80d40947c8b005.js"
integrity="sha256-G5V6rsEnKgMvLUgYWMEHTDej8y7gcXF8W4DUCUfIsAU="></script>

Solution

<script {{ with $load }}{{ . | safeHTMLAttr }}{{ end }} 
src="{{- $js.RelPermalink -}}"
integrity="{{- $js.Data.Integrity -}}"></script>

Gets rendered as — for example:

<script async 
src="/js/bootstrap.cab6a9fd760df551eb4f2d5b061e92f9d3948ab3e72c6ba4621a91ac01c55ca1.js"
integrity="sha256-yrap/XYN9VHrTy1bBh6S&#43;dOUirPnLGukYhqRrAHFXKE="></script><script async 
src="/js/app.1b957aaec1272a032f2d481858c1074c37a3f32ee071717c5b80d40947c8b005.js"
integrity="sha256-G5V6rsEnKgMvLUgYWMEHTDej8y7gcXF8W4DUCUfIsAU="></script>
@h-enk h-enk added the bug Something isn't working label Jan 6, 2023
@h-enk h-enk self-assigned this Jan 6, 2023
@h-enk
Copy link
Member Author

h-enk commented Jan 6, 2023

@h-enk h-enk closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant