0

I want to add a js script near the </body> tag. But, in my project there are more than one layout files having <referenceBlock name="before.body.end">. So, is there a specific order in which these gets executed. I see several scripts added using this handle. I want to add a script at the end of the body tag i.e., near </body> tag.

0

Within <sequence> tad in etc/module.xml: you can place all the modules, which have the same layout definition, so that your module will be loaded after them.

Better idea is to google the words: "magento2 defer js" and find either free or paid extension, which will move all your scripts to the bottom wherever they are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.