Async loading css/js with asset manager

Hello Guys,

I just have short question you may can answer me: Is it possible to load css/js files async with the asset manager? Is there any option?

What I want to have for output (with $asset->outputJs("js");) is something like e.g.:

<script async src="script.js" type="text/javascript"></script>

Thanks, Yannici



30.4k

Hi,

have a look at that thread



7.2k
edited Dec '14

Following https://developer.mozilla.org/en/docs/Web/HTML/Element/script

you can write :

->addJs("assets/scripts/app.js", true, false, ['async' => 'true'])

and check :

myscript = document.querySelector('script').async;