Reputation: 21
I want to use the asset pipeline icw Liquid
, but how can I create the asset_path
from within Liquid. I Know Shopify has asset_url so i created a custom Liquid::Filter
But when I create a Liquid::Filter
to port the ActionView::Helpers::AssetUrlHelper.asset_path
, it doesn't seem to find the asset. I'm probably in the wrong context?
So how does Shopify do that? :)
Upvotes: 1
Views: 1240
Reputation: 461
Shopify's asset_url tag doesn't give you the asset url of of their rails app assets, it gives you the asset url of the asset within your shop itself (or from the theme, which is within your shop). Take a look at https://github.com/Shopify/liquid/blob/master/performance/shopify/shop_filter.rb.
If you need to make the asset_url tag access assets from within your app itself then you can use something like ActionController::Base.helpers.asset_path(filename) within your asset_url tag implementation.
Upvotes: 1