Image Assets in JS

Shopify Partner
257 0 0
Any way to call an image asset from an external JS file in a theme? For example, the equivilent of {{ 'loading.gif' | asset_url }}.
Cliff Spence
0 Likes
Shopify Staff
Shopify Staff
2045 0 40

I recommend exporting a base url from the main theme for the js.

Something like

var asset_url = {{ '' | asset_url };

I’m thinking however of providing a global JS file which exports those variable locations in a unified way.

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes