Skip to content
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

Component to handle most common use cases #225

Open
srchulo opened this issue Jul 31, 2020 · 5 comments
Open

Component to handle most common use cases #225

srchulo opened this issue Jul 31, 2020 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@srchulo
Copy link

srchulo commented Jul 31, 2020

Is your feature request related to a problem? Please describe.
This module is really useful and customizable, but it can be hard to put together the most common options that you want, and sometimes repetitive (needing to repeat the asset location multiple times in multiple requires).

Describe the solution you'd like
I think it would be great to have some helper components that make the most commonly desired behaviors for images super easy, such as:

  • Lazy loading
  • LQIP while loading
  • Use webp version if possible in <picture>
  • Creating multiple sizes of the image and using srcset

Bonuses:

  • Would be great to have a way to do something similar with background images on elements like divs.
  • Would be very cool if it could somehow work with blogs when rendering markdown that has images (like with @nuxtjs/markdownit), or when using v-html.

I've filed a request on Nuxt to have a built in image component solution, but maybe this would also be an appropriate place?

nuxt/nuxt#7771

Describe alternatives you've considered
I've tried implementing it myself a number of different ways, and it's taken a lot of time and my solutions probably aren't the best :) Most recently I used this article along with this nuxt-lazysizes-aspect-ratio-blur repository to get a little closer to what I want (a component that takes care of most of the optimized image work for you), and I still made a fork and some changes to get the image component to be a little better.

@michaelschufi
Copy link

michaelschufi commented Aug 26, 2020

I'm currently working on something similar, with the same goals as you wrote in your post. But I'm having the issue that webpack does not find the image dynamically (#229). Have you come across the same problem? Maybe we can help each other out.

@srchulo
Copy link
Author

srchulo commented Sep 8, 2020

@michaelschufi I had the same issue. I had to require the image before passing it into any component, if that's what you mean.

@shadow81627
Copy link

There is a work in progress nuxt image module: https://github.com/nuxt/image

@srchulo
Copy link
Author

srchulo commented Nov 15, 2020

@shadow81627 very cool! Thanks for letting me know. Starred! :)

@juliomrqz juliomrqz added enhancement New feature or request help wanted Extra attention is needed labels Jan 2, 2021
@ghost
Copy link

ghost commented Mar 31, 2021

@michaelschufi I had the same issue. I had to require the image before passing it into any component, if that's what you mean.

I also solve this. Couldn't find a more elegant way. Although I really wanted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants