Replies: 1 comment 3 replies
-
The current routing mechanism cannot be changed via a configuration and as far as I know the Svelte team has no intention to change that. Having a strict pattern like this leads to a more uniform and contribution-friendly ecosystem. Documenting and finding features becomes easier because everything can be associated with specific files. If you use VS Code, tab names can be configured to reflect the route names, e.g. "workbench.editor.customLabels.patterns": {
"**/routes/{+server,+layout,+page,+error}.{svelte,ts,server.ts,js,server.js}":
"/ (${filename}.${extname})",
"**/routes/*/{+server,+layout,+page,+error}.{svelte,ts,server.ts,js,server.js}":
"/${dirname} (${filename}.${extname})",
"**/routes/*/*/{+server,+layout,+page,+error}.{svelte,ts,server.ts,js,server.js}":
"/${dirname(1)}/${dirname} (${filename}.${extname})",
"**/routes/*/*/*/{+server,+layout,+page,+error}.{svelte,ts,server.ts,js,server.js}":
"/${dirname(2)}/${dirname(1)}/${dirname} (${filename}.${extname})",
"**/routes/**/*/*/*/*/{+server,+layout,+page,+error}.{svelte,ts,server.ts,js,server.js}":
"…/${dirname(2)}/${dirname(1)}/${dirname} (${filename}.${extname})",
}, |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Svelte simplifies reactivity, Bun makes development faster than ever, and Cursor helps me like crazy. My developer experience is sky-high… except for one thing: navigating within my project.
I love SvelteKit, but folder-based routing sometimes feels a bit overwhelming when navigating within my project. Seeing +page.svelte, +layout.svelte, and +page.server.js everywhere feels repetitive, especially when switching between open tabs.
Instead of enforcing these filenames, would it be possible to name the files based on the route itself?
For example for the /dashboard route:
• +dashboard.svelte instead of +page.svelte
• +dashboard.layout.svelte instead of +layout.svelte
• +dashboard.server.ts instead of +page.server.ts
This could make project navigation easier without changing how SvelteKit handles routing.
Has anyone tried something like this? Would it be technically possible with some config adjustments, or is this something that would require a core change?
Beta Was this translation helpful? Give feedback.
All reactions