Skip to content

Releases: zerodevx/svelte-img

v2.1.2

27 Sep 10:20
Compare
Choose a tag to compare
  • Update dependencies (fixes #55)

v2.1.1

25 Aug 09:00
Compare
Choose a tag to compare
  • Upgrade to vite-imagetools@6
  • Add Svelte v5 support since it's backward-compatible
  • Better IDE code hints with sveld

v2.1.0

23 Sep 13:56
Compare
Choose a tag to compare
  • 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'

v2.0.3

26 Aug 08:29
Compare
Choose a tag to compare
  • Fix image src may be malformed (#30)

v2.0.2

19 Aug 15:36
Compare
Choose a tag to compare
  • Add tree-shaking hint for bundlers (fixes #27)
  • Subtle tweaks to FxReveal CSS vars

v2.0.1

10 Aug 17:10
Compare
Choose a tag to compare
  • Fix run query param parsing (#25)

v2.0.0

10 Aug 11:23
Compare
Choose a tag to compare

High-performance responsive/progressive images for SvelteKit.

v2 has landed, and it's more optimised than ever! 🥳

First, a little background. v1 was originally developed to address issues with vite-imagetools, like how:

  • inline directives are merged with default directives, instead of overriding them as expected;
  • there's no easy way to create a <picture> tag;
  • and there's no easy way to generate a base64 LQIP.

Fixing these required a tonne of patching. However, with the v5 release of imagetools (and the merge of this PR), svelte-img can be refactored to work the right way. Benefits include:

  • handling more work at build step;
  • leading to faster component rendering;
  • and a much smaller payload (build size).

So please migrate.

BREAKING CHANGES:

  1. ?run is deprecated; replace with ?as=run when importing images.
  2. run default directives are defined using the runDefaultDirectives key now.
  3. ?lqip={number} is deprecated; replace with ?as=run:{number}.
  4. ?width={number} and ?height={number} are deprecated; use ?w={number} and ?h={number} instead.
  5. Exposed CSS vars for FxReveal have changed.
  6. If you're using svelte-img with an external image API, the src meta data structure has changed; it is now in parity with imagetools' native ?as=picture output format.

v1.2.11

28 Jun 11:19
Compare
Choose a tag to compare
  • Add Svelte v4 support (#16)

v1.2.10

11 Mar 14:00
Compare
Choose a tag to compare
  • Expose shared intersectionObserver svelte action

Use like so:

<script>
import { observe } from '@zerodevx/svelte-img/utils'
</script>

<div use:observe on:enter={...} on:leave={...} />

v1.2.9

07 Mar 08:04
Compare
Choose a tag to compare
  • Fix types export mappings in package.json