Asset url

From Shopify Wiki

Jump to: navigation, search

asset_url(input)

Returns the url for an asset.

Example:

{{ 'shop.css' | asset_url }}

The above example returns the path plus filename of the specified file. In this case it could be something like: "/files/shops/32055/assets/shop.css"

You will most probably use this url with another filter (to create a link or include tag it for instance):

Example:

{{ 'shop.css' | asset_url | stylesheet_tag }}

This would be something you would use in the html's header and would result in something like:

<link href="/files/shops/random_number/assets/shop.css" rel="stylesheet" type="text/css" media="all" />
Personal tools