Using defer attribute in iced-coffeescript

144 Views Asked by At

I'm trying to insert a script tag from an iced-coffeescript file. I wish to specify the script's defer attribute, but the coffeescript compiler doesn't like that I'm trying to define something called defer, since it's a keyword.

Is there any solution that allows me to do the following:

script = document.createElement('script')
script.type = 'text/javascript';
script.defer = true
script.async = true
script.src = "//initrode.com/scripts/myscript.js"

Or am I stuck ande cannot use this attribute?

1

There are 1 best solutions below

0
On BEST ANSWER

Found the answer on the project's GitHub pages. You simple have to replace the line with:

script["defer"] = true