Trying to create an if
block following the Svelte Guide for if blocks. The process appears straightforward, yet Svelte is flagging it as a syntax error:
[!] (svelte plugin) ParseError: Unexpected character '#'
public\js\templates\works.html
3: <div class="slides js_slides">
4: {#each works as work, index}
5: <div class="js_slide {#if index === currentIndex }selected{/if} {#if index === 0 }first{/if}">
^
6: <img src="/images/work/screenshots/{ works[index].slug }-0.{ works[index].imageExtension }"/>
7: </div>
Why isn't {#if index === currentIndex }
considered valid? How can I implement conditionals in Svelte?
I could potentially set up individual class=
definitions for every potential outcome, but that would require extensive effort.