admin管理员组文章数量:1221920
I'm trying to improve site speed, and one thing that might be delaying render are these scripts:
{{ '//ajax.googleapis/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}
{{ 'jGestures.min.js' | asset_url | script_tag }}
{{ 'modernizr.min.js' | asset_url | script_tag }}
How can they be made to asych or defer? Or should I simply move them to the bottom? Also I have not made changes like this to my theme yet. Is it easy to revert changes in Shopify? I would just change it to the way it was before if any of the scripts were needed for the initial render, correct?
Edit: those scripts are in the HEAD section.
I'm trying to improve site speed, and one thing that might be delaying render are these scripts:
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}
{{ 'jGestures.min.js' | asset_url | script_tag }}
{{ 'modernizr.min.js' | asset_url | script_tag }}
How can they be made to asych or defer? Or should I simply move them to the bottom? Also I have not made changes like this to my theme yet. Is it easy to revert changes in Shopify? I would just change it to the way it was before if any of the scripts were needed for the initial render, correct?
Edit: those scripts are in the HEAD section.
Share Improve this question asked Dec 14, 2017 at 21:09 Jake 1986Jake 1986 6021 gold badge10 silver badges26 bronze badges1 Answer
Reset to default 18You have to do it little differently.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" async></script>
<script src="{{ 'jGestures.min.js' | asset_url }}" async></script>
Make sure you copy/download the theme so that you have a backup. also shopify stores revisions so that you can revert back.
本文标签: javascriptHow to async or defer JS in LiquidStack Overflow
版权声明:本文标题:javascript - How to async or defer JS in Liquid? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739316893a2157847.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论