Skip to content

Fallback to standard img when src is a string #60

@asjir

Description

@asjir

When dealing with sources that may or may not be processed by svelte-img we currently have:

{#if typeof image === "string"}
  <img src={image} alt={title} class="w-full h-48 object-cover" />
{:else}
  <Img src={image} alt={title} class="w-full h-48 object-cover" />
{/if}

which, granted, is not that bad.

But it makes me wonder if it wouldn't be better to include switch on the typeof image inside the Img component?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions