如何将外部JavaScript与Shopify网站结合 [英] How to Combine external JavaScript with Shopify website

查看:485
本文介绍了如何将外部JavaScript与Shopify网站结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用Pingdom测试了我的网站,并建议结合使用外部javascript,但是我不知道如何在shopify网站上做到这一点.

I've tested my website with Pingdom and suggested to combine external javascripts, but I don't know how to do this with shopify website.

推荐答案

为Shopify主题添加外部脚本文件非常简单.

Adding external script files for Shopify theme is pretty simple.

您只需要将脚本文件上传到主题文件的素材文件夹.或者,您可以创建一个.js文件,将您的代码粘贴到此处.之后,您只需要将该脚本文件包含在theme.liquid文件中即可.

You just need to upload your script file to the asset folder of your theme file. Or you can create a .js file to paste your code there. After that you just need to include that script file to the theme.liquid file.

只需在theme.liquid文件中的标记末尾之前添加以下内容.

Just need to add the following before end of tag in the theme.liquid file.

{{'您的脚本文件名.js'| asset_url | script_tag}}

{{ 'your-script-file-name.js' | asset_url | script_tag }}

这篇关于如何将外部JavaScript与Shopify网站结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆