79640976

Date: 2025-05-27 18:02:45
Score: 0.5
Natty:
Report link

The tl;dr solution to this is that having images in $lib is a dumb requirement.

I have instead put images in static/assets/<image> and updated the code as follows. It seems that the performance difference between $lib and static/ is irrelevant in this scenario.

<script>
    export let title;
    export let bg_img;
</script>

<div
    class="top-level-card flex h-35 justify-center rounded-2xl bg-cover bg-center shadow-xl"
    style:background-image={`url(/assets/${bg_img})`}
>
    <p class="bg-primary text-text-1 h-fit rounded-b-2xl px-3 pb-1 text-xl">{title}</p>
</div>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Zax71