How to use async attribute in script tag in haml?
Asked Answered
V

2

9

How to add attributes like async or defer in script tag in Haml? I tried to put it on a same line as href, but it does not work.

 %a.twitter-share-button{href: "https://twitter.com/share?ref_src=twsrc%5Etfw", data: { url: "http://example.net", show: { count: "false" } } } Tweet
Vierno answered 25/11, 2017 at 4:1 Comment(0)
V
12
%script{async: true, await: true, src: "hogehoge.com/test.js"}

I found that I could put those attributes to script tag with this syntax.

Vierno answered 10/12, 2017 at 9:45 Comment(0)
S
0

Should be:

%script{async: 'async', src: 'hogehoge.com/test.js', type: 'application/javascript'}
Swordtail answered 27/10, 2021 at 22:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.