leaf-kit
leaf-kit copied to clipboard
Add a `#routes` or `#link_to` Tag
Is your feature request related to a problem? Please describe. I'm currently looking for a way to add my routes in my leaf templates
<a href="#routes(home)">Home</a>
# => <a href="/home">Home</a>
Describe the solution you'd like I would like for a way to add routes to leaf templates
Describe alternatives you've considered thought about hardcoding them but that is too tedious and it doesn't scale very well
Additional context As an Example here is a Rails
<%= link_to "Home", @home %>
# => <a href="/home">Home</a>
@natebird @tonyarnold @ts @shnhrrsn Just wanting to know if there is anyway for this in the future
+1 for this, in fact it feels like quite a blind spot in Vapor's type safety, the fact that URLs are all produced with string concatenation. Having a URL builder interface to the router, that is validated as much as possible, and then exposed in Leaf templates, would be really nice. Even in a small Vapor application I've wanted this quite a few times.
I'll probably end up writing something for this myself, if it becomes generically applicable then I'll try and contribute it or at least get a gist up somewhere.