title: How do I generate an Asset URL inside of a ScriptTag?
body: <p>My Shopify App is creating a <a href="https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag?api%5Bversion%5D=2020-04" rel="nofollow noreferrer">ScriptTag</a> when the app is installed. When the script tag is loaded in the store (each time a customer visits), I was hoping to be able to fetch an asset's public url from the client-side JavaScript.</p>
  <p>Since the ScriptTag is executed onload, something like this does not seem to work:</p>
  <p><code>var assetPath = &quot;{{ 'my-test-file.css' | asset_url }}&quot;</code></p>
  <p>Are there any alternative methods available to generate an asset url from the JavaScript file that is loaded on the client? Or is my only option to fetch this public URL from the <a href="https://shopify.dev/docs/admin-api/rest/reference/online-store/asset?api%5Bversion%5D=2020-04#index-2020-04" rel="nofollow noreferrer">Asset API</a> using my backend?</p>