Skip to content

Commit c78dcb2

Browse files
committed
Upgrade to vite-imagetools@6
1 parent f186e45 commit c78dcb2

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/lib/Picture.svelte

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
<script>
2-
import { len } from './utils.js'
3-
42
export let sources = {}
53
export let sizes = undefined
64
75
let srcs = []
86
9-
$: if (len(sources)) {
10-
const list = []
11-
for (const [format, imgs] of Object.entries(sources)) {
12-
list.push({
13-
format,
14-
srcset: imgs.map((i) => `${i.src} ${i.w}w`).join()
15-
})
16-
}
17-
srcs = list
18-
} else {
19-
srcs = []
20-
}
7+
$: srcs = Object.entries(sources)
218
</script>
229

23-
{#if len(srcs)}
10+
{#if srcs.length}
2411
<picture>
25-
{#each srcs as { format, srcset }}
12+
{#each srcs as [format, srcset]}
2613
<source type="image/{format}" {sizes} {srcset} />
2714
{/each}
2815
<slot />

0 commit comments

Comments
 (0)