Skip to content

Choosing an Approach ​

Image Kit can prepare images in several ways, and most tasks can be solved by more than one of them. This page lists what each approach does, so you can pick one and jump to a ready-made configuration.

Two separate jobs are easy to mix up:

  • Responsive variants — resizing a source image into several widths and formats (400w, 800w, WebP, AVIF …) so the browser downloads the smallest suitable file.
  • Placeholders — a tiny HazeHash, BlurHash, ThumbHash or dominant color, plus the image size, shown while the real image loads. Nothing is resized and no file is written.

You can use either job on its own or both together. If a project only needs a blur while images load, it never has to generate variants.

What do you need? ​

The approaches side by side ​

ApproachWrites filesRuns atWorks with a runtime-built srcNeeds
?placeholder (a field list), ?hazehash, ?blurhash, ?color, ?size, ?previewnobuild / devno — one import per imageVite plugin, sharp
import.meta.glob with ?placeholdernobuild / devby file nameVite plugin, sharp
Manifest from dirs / urlsnobuild / devyesVite plugin or Nuxt, sharp
placeholders commandthe manifest or your templateswhen you run itwith --dir / --urlsharp
?vik importyesbuild / devnoVite plugin, sharp
Batch generation (generate)yesbuild / devyes — files exist on diskVite plugin or CLI, sharp
On-demand servercache onlyon each requestyesa Node server, sharp

thumbhash is also needed wherever a ThumbHash is computed. See Installation.

How a placeholder reaches <VImage> ​

Every approach ends in one of three ways, and it helps to know which you are using:

  • Props — the values are passed to the component directly: v-bind="placeholder", :hazehash="hash", or written into the template by the command.
  • Manifest — a src → placeholder map is registered once, and <VImage> finds its entry by the exact src string. No per-usage props. See Placeholders manifest.
  • Variants metadata — a ?vik import or a generated manifest carries the placeholder together with the resized URLs, and is passed as the image prop.

An image imported into a component (import hero from './hero.jpg') gets a hashed URL when the app is built, so a manifest lookup by src can never find it. Use props for those, or serve the image from a folder with a fixed URL.

Recipes ​

  • Vite and Vue — every plugin configuration, from a bare blur to variants and a folder manifest together.
  • Nuxt — the module options, and when the Vite plugin has to be added by hand.
  • CLI, CDN and remote images — projects without the plugin, CDN images, a CI report.