-
-
Notifications
You must be signed in to change notification settings - Fork 72
-
In order to create a component library that integrates with Phoenix and LiveSvelte (e.g., duplicating the functionality of <.button> with navigate=), it is desirable to retain the compile-time checks of ~p.
Something like this:
~V"""
<h1>Heading</h1>
<a href={~p"/"} data-phx-link="redirect" data-phx-link-state="push"><button class='btn btn-sm variant-filled'>Push Back</button></a>
"""
Currently results in this:
svelte/_build/Elixir.KantanWeb.Svelte.Navigation.svelte:2:11:
2 │ 1: <a href="/" ><button class='btn btn-sm variant-filled'>Regular B...
╵ ^
2: <a href={~p"/"} data-phx-link="redirect" data-phx-link-state="push"><button class='btn btn-sm variant-filled'>Push Back</button></a>
I'm sure this isn't surprising.
Maybe there's a better way to do this, or perhaps it is impossible.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Replies: 1 comment
-
Good idea. I'm not sure it's possible though. We would have to check Svelte files during compilation and somehow get the information from Phoenix about what routing is configured. Technically it should be possible somehow, but it's not so easy in practice.
Would need some help with this.
Beta Was this translation helpful? Give feedback.