We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
vite-imagetools@6
1 parent f186e45 commit c78dcb2Copy full SHA for c78dcb2
src/lib/Picture.svelte
@@ -1,28 +1,15 @@
1
<script>
2
-import { len } from './utils.js'
3
-
4
export let sources = {}
5
export let sizes = undefined
6
7
let srcs = []
8
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
-}
+$: srcs = Object.entries(sources)
21
</script>
22
23
-{#if len(srcs)}
+{#if srcs.length}
24
<picture>
25
- {#each srcs as { format, srcset }}
+ {#each srcs as [format, srcset]}
26
<source type="image/{format}" {sizes} {srcset} />
27
{/each}
28
<slot />
0 commit comments