Closed mattbrictson closed 1 year ago
Hi Matt!
Sounds reasonable to add vite_picture_tag
once picture_tag
is released.
To avoid users from attempting to use it in older versions of Rails it might be preferable to do something like:
if defined?(Rails) && Rails.gem_version >= Gem::Version.new("7.1")
def vite_picture_tag(*sources, &block)
Is your feature request related to a problem? Please describe.
Rails introduced a
picture_tag
helper earlier this year. It is on the main branch (not yet released) and presumably will be part of Rails 7.1.Describe the solution you'd like
I'd like to see a
vite_picture_tag
wrapper, perhaps with an implementation like this:Describe alternatives you've considered
The tag helper is syntax sugar;
<picture>
tags can of course still be created manually without too much effort:Versus:
Additional context
I'd be happy to contribute a PR, but I am wondering: should I wait until Rails 7.1 is released?