The density parameter in the configuration is not redefined, but adds new values to the default ones
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 331
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 9
Description
NuxtImage v2.0.0
<NuxtImg src="/test.jpg" width="500"/>
export default defineNuxtConfig({
image: {
densities: [4]
}
})
This config gives this result
<img width="500"
data-nuxt-img
srcset="
/_ipx/f_avif&w_500&q_80/test.jpg 1x,
/_ipx/f_avif&w_1000&q_80/test.jpg 2x,
/_ipx/f_avif&w_2000&q_80/test.jpg 4x"
onerror="this.setAttribute('data-error', 1)"
src="/_ipx/f_avif&w_500&q_80/test.jpg">
If I only want 1x and use this configuration
export default defineNuxtConfig({
image: {
densities: [1]
}
})
I still get the same result (1x adn 2x) but expected only (1x)
<img width="500"
data-nuxt-img
srcset="
/_ipx/f_avif&w_500&q_80/test.jpg 1x,
/_ipx/f_avif&w_1000&q_80/test.jpg 2x"
onerror="this.setAttribute('data-error', 1)"
src="/_ipx/f_avif&w_500&q_80/test.jpg">
The only thing that helps is either using a preset or the density attribute in NuxtImg
It's a similar story with the format parameter
export default defineNuxtConfig({
image: {
format: ['avif'],
}
})
The image is still rendered as a JPEG, not an AVIF.
This can only be resolved by specifying a modifier for a specific provider or by using the format attribute in NuxtImg
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the NuxtImg configuration handling for the densities and format options, then trace how those values reach the generated srcset and image format. Reproduce the examples from the issue and verify that configured values replace the defaults and that the rendered output uses only the requested format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxtjs, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100