Create a gist now

Instantly share code, notes, and snippets.

Use dimensions by @sstephenson to add automatic images size and improve browser rendering
module DimensionsHelper
# How this improves browser rendering?
# https://developers.google.com/speed/docs/best-practices/rendering#SpecifyImageDimensions
#
def image_tag source, options = {}
unless options[:size]
fs_path = asset_paths.asset_for(source, nil)
options[:width], options[:height] = Dimensions.dimensions(fs_path)
end
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment