You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! What do you think of support the folders "media/images" as the webpacker helper image_pack_tag does?
In the implementation of webpacker helpers, it has the following code:
def resolve_path_to_image(name)
path = name.starts_with?("media/images/") ? name : "media/images/#{name}"
asset_path(current_webpacker_instance.manifest.lookup!(path))
rescue
asset_path(current_webpacker_instance.manifest.lookup!(name))
end
Maybe we can do something similar with InlineSvg::WebpackAssetFinder like this, or try to use the resolve_path_to_image method of webpacker:
module InlineSvg
class WebpackAssetFinder
def self.find_asset(filename)
...
end
def initialize(filename)
@filename = filename.starts_with?('media/images/') ? filename : "media/images/#{filename}"
end
def pathname
...
end
end
end
The text was updated successfully, but these errors were encountered:
felipefava
changed the title
support implicit "media/images"
support implicit "media/images" for webpack inline_svg_pack_tag
Dec 17, 2019
Yeah, I think It's nice for consistency between the helper image_pack_tag and inline_svg_pack_tag.
I mean, if in some part of the code I use image_pack_tag 'my_folder/my_image.png', I would also expect to use inline_svg_pack_tag 'my_folder/my_svg.svg' instead of inline_svg_pack_tag 'media/images/my_folder/my_svg.svg.
These next days I will be really busy, but I would definitely try to open a PR next month. Thanks for the reply.
I mean, if in some part of the code I use image_pack_tag 'my_folder/my_image.png', I would also expect to use inline_svg_pack_tag 'my_folder/my_svg.svg' instead of inline_svg_pack_tag 'media/images/my_folder/my_svg.svg.
Hi! What do you think of support the folders
"media/images"
as the webpacker helperimage_pack_tag
does?In the implementation of webpacker helpers, it has the following code:
Maybe we can do something similar with
InlineSvg::WebpackAssetFinder
like this, or try to use theresolve_path_to_image
method of webpacker:The text was updated successfully, but these errors were encountered: