vite-plugin-pages icon indicating copy to clipboard operation
vite-plugin-pages copied to clipboard

Add `sveltekit` routeStyle

Open marekvospel opened this issue 2 years ago • 2 comments

Description

Add sveltekit's route style (https://kit.svelte.dev/docs/routing), in which only files called +page.svelte are taken as a page, so the route is defined by the directory structure only and components meant only for some pages can live along each other. example:

pages/
  admin/
    AdminNavbar.svelte (this is just a component used in admin routes, it's not taken as a route)
    +page.svelte (this is `/svelte` page)
  +page.svelte (this is `/` page)
  • [X] Am willing to create a PR

Suggested solution

sveltekit routeStyle option and it's logic would be added into vue resolver (possibly other frameworks, I'm not really familiar with solid / react)

Alternative

No response

Additional context

No response

Validations

  • [X] Follow the Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

marekvospel avatar Sep 29 '22 18:09 marekvospel

What needs to be discusseed is the inclusion of the catch all route [...id], as sveltekit solves those with layouts and error pages. In my opinion catch all routes should work just like in next route style.

https://kit.svelte.dev/docs/routing#layout https://kit.svelte.dev/docs/routing#error

marekvospel avatar Sep 29 '22 19:09 marekvospel

Today I've realised it's possible to add +layout by transfoming parent's rawRoute inside the parent check. The only problem there is right now is +layout in pages root

src/pages
  about/
    +layout.vue // this does work
    +page.vue
  +layout.vue // this does not work
  +page.vue

marekvospel avatar Oct 03 '22 10:10 marekvospel