Using Layout XML to Reorder JavaScript in Magento

Posted on: 26 Nov 2019 by Admin

If you want to force the load order of Javascript included with the addJs method, the easiest way is to supply a name using the .
You can use the element, with name attribute in it.
Magento will load the Javascript files in alphabetical order based on the name supplied.
Let’s jump into the live source code given by the Magento Development Company

 

<action method="addJs">%MINIFYHTMLca89d549fe6e350e7adb8e34c2cc9ede8%<params><!--[CDATA[name="js002_second"]]--></params>
</action>

<action method="addJs">%MINIFYHTMLca89d549fe6e350e7adb8e34c2cc9ede9%<params><!--[CDATA[name="js001_first"]]--></params>
</action>