Skip to main content
3 of 3
edited tags
zhartaunik
  • 3.8k
  • 4
  • 24
  • 54

Change order of JavaScript files in head

I add a custom JavaScript file with the following code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="VendorNamespace_Module::someJs.js"/>
    </head>
</page>

My problem is that this js file requires jQuery, but it is loaded before the jQuery JavaScript file (when I look at the head section of my html, jQuery.js comes after someJs.js). How can I change this order so that my file is loaded afterwards?

bpoiss
  • 773
  • 2
  • 8
  • 24