Skip to content

Commit

Permalink
fix: generate static images even if lazy loaded (#233)
Browse files Browse the repository at this point in the history
* fix: generate static images even if lazy loaded

closes #232

* fix: process nsizes as well
  • Loading branch information
danielroe authored Apr 27, 2021
1 parent ad2fac0 commit 5be72a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/runtime/components/nuxt-img.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ export default defineComponent({
return attrs
},
nSrc (): string {
// Calculate src first to trigger creation of static image
const src = this.sizes ? this.nSizes.src : this.$img(this.src, this.nModifiers, this.nOptions)
if (this.lazyLoad) {
return EMPTY_GIF
}
if (this.sizes) {
return this.nSizes.src
}
return this.$img(this.src, this.nModifiers, this.nOptions)
return src
},
/* eslint-disable no-undef */
nSizes (): ImageSizes {
Expand Down

0 comments on commit 5be72a5

Please sign in to comment.