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.
-
Did you do some investigation before asking this question?Jeroen Heier– Jeroen Heier2017-09-07 03:53:04 +00:00Commented Sep 7, 2017 at 3:53
-
yes, i also minified the js but still my score in pingdow wont get higher than 83Marvyn Sue– Marvyn Sue2017-09-11 06:12:32 +00:00Commented Sep 11, 2017 at 6:12
Add a comment
|
1 Answer
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 }}
5 Comments
Marvyn Sue
i tried to do it,but it only displays a broken site
Marvyn Sue
some of the js files are not inside assets
Debashis Dash
asset_url filter will search for the file in the asset folder of your theme
OG Sean
If the file is in the themes folder, then it's not "external" as the OP title asks for.
Debashis Dash
You can either download the script and upload it to the Shopify theme CDN to use or simply through the Script tag which can include the external JS file or link.