Sha256: eb40a0c5670777cee39f2903a0e647f54488921070b69f5c485b6a5603a5cab3
Contents?: true
Size: 865 Bytes
Versions: 1
Compression:
Stored size: 865 Bytes
Contents
module InlineSvg class WebpackAssetFinder def self.find_asset(filename) new(filename) end def initialize(filename) @filename = filename end def pathname file_path = Webpacker.instance.manifest.lookup(@filename) return unless file_path if Webpacker.dev_server.running? asset = Net::HTTP.get(Webpacker.dev_server.host, file_path, Webpacker.dev_server.port) begin Tempfile.new(file_path).tap do |file| file.binmode file.write(asset) file.rewind end rescue StandardError => e Rails.logger.error "Error creating tempfile: #{e}" raise end else public_path = Webpacker.config.public_path return unless public_path File.join(public_path, file_path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inline_svg-1.7.0 | lib/inline_svg/webpack_asset_finder.rb |