Categories
CMS Joomla Mastering Development

How do I add async attribute for scripts?

I would like to add async to script tags coming from here <jdoc:include type="head" />.

I have done some research and I found a few solutions, however those are for custom scripts.

I managed to find a workaround by editing the core file HeadRenderer.php located in [root]/libraries\src\Document\Renderer\Html and directly adding the async attribute, but It doesn’t feel quite right.

Is it possible to add async and media="all for Joomla core scripts and css, such as templates/system/css/general.cssand media/jui/js/jquery-migrate.min.js?06b66bce294749c101f79cb21aac7ace?

So my question is:

Is there any way to either override the head core file or adding async from my index.php file?

Leave a Reply

Your email address will not be published. Required fields are marked *