Skip to content

Commit

Permalink
Add image placeholders and preload main image
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofVDB1 committed Nov 29, 2023
1 parent ea80863 commit ecd8875
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions components/c-header/c-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<div class="header__image-container" v-if="image">
<div class="header__image-container__wrapper">
<NuxtImg
preload
format="webp"
placeholder
class="header__image-container__wrapper__image"
src="/images/image.jpeg"
:width="image?.width ?? 700"
Expand Down
2 changes: 2 additions & 0 deletions components/card/card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<a :href="link?.href" class="card">
<div class="card__image-container">
<NuxtImg
format="webp"
placeholder
class="card__image-container__image"
src="/images/image.jpeg"
width="350"
Expand Down
7 changes: 6 additions & 1 deletion components/image-gallery/image-gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
:items-to-show="1.9"
>
<custom-slide v-for="(image, index) in images" :key="index">
<NuxtImg class="image-gallery__image" :src="image?.src" />
<NuxtImg
class="image-gallery__image"
:src="image?.src"
format="webp"
placeholder
/>
</custom-slide>

<template #addons>
Expand Down
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default defineNuxtConfig({
carousel: {
prefix: 'custom',
},
image: {
format: ['webp']
},
content: {
documentDriven: true,
highlight: {
Expand Down

0 comments on commit ecd8875

Please sign in to comment.