简体   繁体   中英

Shopify Call a json file in JavaScript code from assets

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>

You can call this file path using below code

{{'data.json'| asset_url}}

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM