Ad

Shopify Call A Json File In JavaScript Code From Assets

- 1 answer

Shopify... I have uploaded a json file into assets. I have JavaScript code which requires the directories of the json file. Please see the following code below-

container: elem,
        renderer: 'svg',
        loop: false,
        autoplay: true,
        rendererSettings: {
            progressiveLoad:false
        },
        path: 'data.json'   <-----I need to call the json file here   it is already uploaded into assests*******************************************************>
    };
    anim = bodymovin.loadAnimation(animData);
</script>
Ad

Answer

You can call this file path using below code

{{'data.json'| asset_url}}

Thanks

Ad
source: stackoverflow.com
Ad