Hi -
With the new AssetBundle is there a way to load the JS with async or defer?
I didn’t see it in the code but maybe there is a special way of doing it.
- Matt
Hi -
With the new AssetBundle is there a way to load the JS with async or defer?
I didn’t see it in the code but maybe there is a special way of doing it.
In your AssetBundle try setting the [font="Courier New"]jsOptions[/font] property (not tried this but should theoretically work):
$jsOptions = ['async'=>'async'];
// or
$jsOptions = ['defer'=>'defer'];
Alternatively, you can control the async/defer properties through [font="Courier New"]View::registerJsFile()[/font]
you are right it works.
thanks