How to Combine external JavaScript with Shopify website

流过昼夜 提交于 2019-12-24 01:53:28

问题


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.


回答1:


Adding external script files for Shopify theme is pretty simple.

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.

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

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



来源:https://stackoverflow.com/questions/46087470/how-to-combine-external-javascript-with-shopify-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!