feat: add static generation support for nuxt picture - #674
Conversation
|
Changes in this PR fixed image generation in my project. Project is using simple: <nuxt-picture
:src="..."
:imgAttrs="{ class: '...' }"
/>👍 |
|
@danielroe Our full static nuxt3 site relies on this PR for release - it affects mobile Lighthouse performance. Is there an estimated release time? Can we assist? |
| nSources.value[srcKey].src, | ||
| ...(nSources.value[srcKey].srcset || '').split(',').map(s => s.trim().split(' ')[0]) | ||
| ].filter(s => s && s.includes('/_ipx/')) | ||
| appendHeader(useRequestEvent(), 'X-Nitro-Prerender', sources.join(',')) |
There was a problem hiding this comment.
Refactor: We shall create a utility (prerenderImages(sources: string[]) to reuse logic with img/picture components (
image/src/runtime/components/nuxt-img.ts
Line 89 in 200842a
|
How did you use this in your project ? I changed my |
|
Thanks for PR! Landed via #725 |
Not sure if this is the right approach, but copied similar generation logic from the nuxt-img component.
It seemed to work first try, so opening a PR in case it is useful.