From b25e5c4943d59c6e1f66c1fbb32ce64a4dd8a934 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:18:33 +0100 Subject: [PATCH] feat: create Image.svelte --- src/lib/Image.svelte | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/lib/Image.svelte diff --git a/src/lib/Image.svelte b/src/lib/Image.svelte new file mode 100644 index 0000000..e7cfb65 --- /dev/null +++ b/src/lib/Image.svelte @@ -0,0 +1,53 @@ + + +{#snippet img(src: string)} + +{/snippet} + +{#if src.startsWith('http')} + {@render img(src)} +{:else} + {@const enhancedSrc = importImage(src)} + {#if enhancedSrc != null} + + {:else} + {@render img(src)} + {/if} +{/if}