zerodevx / svelte-img

High-performance responsive/progressive images for SvelteKit
https://zerodevx.github.io/svelte-img/
ISC License
300 stars 11 forks source link

Support profiles #33

Closed zerodevx closed 9 months ago

zerodevx commented 10 months ago

Like so:

import src1 from '$lib/a/1.jpg?as:run'
import src2 from '$lib/a/2.jpg?as:profile'

Define profiles in vite.config.js:

...
plugins: [
  sveltekit(),
  imagetools({
    profiles: {
      profile: new URLSearchParams('w=640;1280&format=webp;jpg')
    }
  })
]