v2.1.0
- Add support for multiple profiles (#33)
- Deprecate
runDefaultDirectives
but still works for backward compatibility
Define profiles in vite.config.js
:
// `runDefaultDirectives` is deprecated; use `profiles` instead
...
plugins: [
sveltekit(),
imagetools({
profiles: {
// override defaults
run: new URLSearchParams('w=640;1280&format=webp;jpg'),
// add new profile(s)
new1: new URLSearchParams('w=320&h=320&fit=cover&format=png'),
new2: new URLSearchParams('w=640;1280&format=webp;jpg')
}
})
]
Invoke profile in app:
import src1 from '$lib/a/1.jpg?as=new1'
import src2 from '$lib/a/2.jpg?as=new2'