-
Notifications
You must be signed in to change notification settings - Fork 144
feat: Add vite_picture_tag for Rails 7.1 #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,4 +180,16 @@ def test_vite_image_tag | |
| vite_image_tag('images/logo.png', srcset: { 'images/logo-2x.png' => '2x' }, alt: 'Logo') | ||
| } | ||
| end | ||
|
|
||
| if Rails.gem_version >= Gem::Version.new('7.1.0') | ||
| def test_vite_picture_tag | ||
| assert_equal <<~HTML.gsub(/\n\s*/, ''), vite_picture_tag('images/logo.svg', 'images/logo.png', class: 'test', image: { alt: 'Logo' }) | ||
| <picture class="test"> | ||
| <source srcset="/vite-production/assets/logo.322aae0c.svg" type="image/svg+xml" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize this PR is ~9 months old, but this line has different output for me. Running Rails 7.1.3.4, the Maybe related to rails/rails#48266 ? Curious to see a CI run after #467
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mjankowski I can't reproduce what you are seeing locally. Using vite_ruby @ main, and running Digging through the Rails source, my guess is that I found this comment:
So maybe Action Dispatch isn't being loading in your environment, for some reason?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks ... think I tracked it down. I have a branch going trying to get rid of some of deprecation noise during spec run, and I did a bit of branch jam-up on myself, and I think I had |
||
| <source srcset="/vite-production/assets/logo.f42fb7ea.png" type="image/png" /> | ||
| <img alt="Logo" src="/vite-production/assets/logo.f42fb7ea.png" /> | ||
| </picture> | ||
| HTML | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ποΈ I updated the lock file to be able to test against Rails 7.1.0. Let me know if I should split this into a separate commit or PR.