简体   繁体   English

Magento 2 最后加载JS

[英]Magento 2 load JS at the end

could somebody help me how/in which files can I edit the order of loading scripts?有人可以帮助我如何/在哪些文件中编辑加载脚本的顺序? My product page (only the product page) is VERY slow, and I'm trying to load JS at the very end.我的产品页面(只有产品页面)非常慢,我正在尝试在最后加载 JS。

Thanks谢谢

if you have magento 2.3.2+ you can enable move javascript to bottom of page by following this steps如果您有 magento 2.3.2+,您可以按照以下步骤启用将 javascript 移动到页面底部

Store > Configuration > Advanced > Developer > Javascript Settings and set yes for Move JS code to the bottom of the page商店>配置>高级>开发人员> Javascript 设置并将JS 代码移动到页面底部设置为是

将JS代码移动到页面底部

if you have older magento version you can use some extensions listed in github to deferejs loading like this one https://github.com/taoufiqaitali/magento2-defer-parsing-of-javascript如果你有旧的 magento 版本,你可以使用 github 中列出的一些扩展来延迟像这样的加载 Z5E056C500A1C4B6A7110B50D807BADElingi-of- to2javascript

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM