-
Notifications
You must be signed in to change notification settings - Fork 270
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
if (process.server && process.env.prerender) { |
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.