<script async > support
Rikcon opened this issue · comments
Hello, it would be good if you could implement a feature that allows adding async to a script tag.
Here is doc about it http://www.w3schools.com/tags/att_script_async.asp
Hi @Rikcon.
The js()
function currently supports passing an array of attributes to customize the rendered script tag or you could even pass a closure to take full control of the script tag.
i.e: Using Assets::add('effects.js')->js(['foo' => 'bar', 'async']);
will result in
<script type="text/javascript" src="js/effects.js" foo="bar" async="async">
or you could use
Assets::js(function ($assets) {
$output = '';
foreach($assets as $a)
$output .= '<script src="' . $a . '" async></script>';
return $output
});
More info in the API docs