From d2323453ebed53e203fba32c40a5747b493cd6a6 Mon Sep 17 00:00:00 2001 From: Kyle Fox Date: Wed, 12 Feb 2020 14:17:24 -0700 Subject: [PATCH] make WebpackAssetFinder#pathname do less --- lib/inline_svg/webpack_asset_finder.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/inline_svg/webpack_asset_finder.rb b/lib/inline_svg/webpack_asset_finder.rb index 361e1c1..6d55fef 100644 --- a/lib/inline_svg/webpack_asset_finder.rb +++ b/lib/inline_svg/webpack_asset_finder.rb @@ -6,19 +6,16 @@ def self.find_asset(filename) def initialize(filename) @filename = filename + @asset_path = Webpacker.manifest.lookup(@filename) end def pathname - file_path = Webpacker.instance.manifest.lookup(@filename) - return unless file_path + return if @asset_path.blank? if Webpacker.dev_server.running? - dev_server_asset(file_path) - else - public_path = Webpacker.config.public_path - return unless public_path - - File.join(public_path, file_path) + dev_server_asset(@asset_path) + elsif Webpacker.config.public_path.present? + File.join(Webpacker.config.public_path, @asset_path) end end