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

Doc: NuxtImg multiple formats #1552

Open
Yves852 opened this issue Oct 23, 2024 · 2 comments
Open

Doc: NuxtImg multiple formats #1552

Yves852 opened this issue Oct 23, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@Yves852
Copy link

Yves852 commented Oct 23, 2024

Tested the format prop like the following, switching order and testing with typos. Image type (not extension) seems to change/fallback accordingly.

<NuxtImg format="webp,jpg" src="/nuxt-icon.png" ... />

Could the use of multiple format be explained in the doc for NuxtImg?

Is it advised to use multiple formats with NuxtImg comparing to NuxtPicture?
If not could it have a warn in the doc against this practice?

Current doc: https://image.nuxt.com/usage/nuxt-img#format

Thanks.

@Baroshem
Copy link
Collaborator

In my experience, I usually set only one format for component NuxtImg (like format='avif'). I looked how Next Img does that and they seem to only support setting format in the global configuration not inline component.

What would be your opinion @danielroe? Should we only allow to set multiple formats throght the global config and only allow to set one format in NuxtImg? Or should we allow for this fallback?

If it works already, maybe it would be good to just document it and support it as per comment of @Yves852 ? :)

@Baroshem Baroshem added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Dec 11, 2024
@Yves852
Copy link
Author

Yves852 commented Jan 17, 2025

When used with provider it will prevent the image displaying, probably due to the whole string being used to request a unique format which is incorrect.

<NuxtImg format="webp,jpg" provider="directus" src="/nuxt-icon.png" ... />

Maybe I should open a feature request to handle multiple format (the last being fallback), right now waiting to see if this issue get an update first.

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

No branches or pull requests

2 participants