Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[...rest] route params #545

Closed
Rich-Harris opened this issue Jan 6, 2019 · 2 comments
Closed

[...rest] route params #545

Rich-Harris opened this issue Jan 6, 2019 · 2 comments

Comments

@Rich-Harris
Copy link
Member

This has come up a few times but I just realised we don't have an issue for it (that I can find).

It'd be cool if there were a way to match paths of arbitrary depth. Happily, there's a really nice idiomatic way we can achieve that, by using rest syntax:

src/routes/foo/[...bar]/baz.html

This would match /foo/a/b/c/baz, and params.bar would equal ['a', 'b', 'c'].

@chris-morgan
Copy link

Ah yes, that’s the issue that I was going to file a couple of days ago, before I decided to shelve the project until Svelte 3 is ready for use!

Spread syntax is indeed a nice solution to it.

For a couple of projects I have in mind, I’d call this not just cool, but essential, given arbitrary nesting structures.

If this is still undone when the dust settles for Svelte 3, I’d be willing to implement it. (On the surface it doesn’t look like it should be particularly difficult.)

@Rich-Harris
Copy link
Member Author

added in 0.26

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants