Can I reference another asset JS file from an asset JS file in a theme extension using liquid?

Shopify Partner
19 0 4

In the context of a theme extension... I have multiple js files in my assets folder. Can I reference other files from one file using liquid? For example, if I have an app.js file and a number.js file. Can I do this from my app.js file?


For instance



    const script = document.createElement('script');
    script.type = 'text/javascript';
    script.setAttribute('src', "{{ 'number.min.js' | asset_url }}");
    script.onload = function () {


Reply 1 (1)

Shopify Partner
1213 214 245

This is Noah from PageFly - Shopify Page Builder App


Hi @Elías  Yes you can. Then to use the file, you just need to use this code to call that file:

Screen Shot 2024-05-20 at 15.26.51.png

Hope my solution will help you resolve the issue.

Best regards,

Noah | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!

PageFly - #1 Page Builder for Shopify merchants.

All features are available from Free plan. Live Chat Support is available 24/7.