IPX Static

Provider documentation

IPX Static

Generate normalized IPX paths for pre-generated image assets.

Setup

Install the framework package and the core package for the provider import:

npm install @desource/image @desource/image-svelte

Save this as image.config.ts beside your example component. Replace sample domains and identifiers with your own.

import type { ImageConfig } from '@desource/image';
import { ipxStaticProvider } from '@desource/image/providers/ipxStatic';

export const imageConfig = {
  provider: 'ipxStatic',
  domains: ['images.example.com'],
  providers: {
    ipxStatic: ipxStaticProvider({
      "path": "/_ipx"
    })
  }
} satisfies ImageConfig;

Registering this provider makes it the default for the configured components. To mix services, register each provider and set provider="ipxStatic" on the image that should use this one.

Image source

Use the same local or allowed remote sources as IPX.

/img/hero.jpg

Usage

The example uses the shared configuration above and the Svelte image component.

<script lang="ts">
  import { Image, setImageConfig } from '@desource/image-svelte';
  import { imageConfig } from './image.config';

  setImageConfig(imageConfig);
</script>

<Image
  src="/img/hero.jpg"
  alt="Sample image" width={800} height={500}
  modifiers={{
  "quality": 80,
  "format": "webp"
}}
/>

Provider options

path
Output path prefix; defaults to /_ipx. baseURL takes precedence.

Pass shared defaults such as screens, domains, aliases and presets to the image configuration. Pass provider-specific defaults as modifiers in the provider factory.

Modifiers

Uses the IPX modifier syntax. Width and height combine into resize, and repeated slashes in the encoded source path are collapsed for static paths.

Set dimensions on the component and pass service-specific operations through modifiers, as shown above. See the provider source for exact mappings and the service documentation for accepted values.

Provider notes

  • This provider only generates URLs. It does not crawl pages, transform files during the build or write static output.
  • A static deployment must pre-generate every requested transformation and publish files at the generated paths. Use ordinary IPX with a server handler for on-demand transformations.
← Back to all providers