Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for ~p #42

dev-guy started this conversation in Ideas
Discussion options

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /