Skip to content

support implicit "media/images" for webpack inline_svg_pack_tag #109

@felipefava

Description

@felipefava

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions