How to defer JavaScript execution to page has been loaded using "defer" attribute

javascript
(Dmitry Fedyuk) #1

Magento 2 supports standard script deferring by means of defer attribute (but never uses it in core):

<?xml version='1.0'?>
<page 
	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
	layout='admin-login' xsi:noNamespaceSchemaLocation='../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd'>
	<head>
		<script src='Dfe_Login::main.js' defer='defer'/>
	</head>
</page>
0 Likes

How to add JavaScript / CSS / Less with a custom module