lib/shimmer/utils/file_helper.rb in shimmer-0.0.30 vs lib/shimmer/utils/file_helper.rb in shimmer-0.0.31
- old
+ new
@@ -18,10 +18,10 @@
if source.is_a?(ActiveStorage::Variant) || source.is_a?(ActiveStorage::Attached) || source.is_a?(ActiveStorage::Attachment) || source.is_a?(ActionText::Attachment)
attachment = source
width = options[:width]
height = options[:height]
source = image_file_path(source, width: width, height: height)
- options[:loading] = :lazy
+ options[:loading] ||= :lazy
options[:srcset] = "#{source} 1x, #{image_file_path(attachment, width: width.to_i * 2, height: height ? height.to_i * 2 : nil)} 2x" if options[:width].present?
end
super source, options
end