Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, it's easy to get confused with folders and folders of +page.svelte

[slug].svelte would be better [slug]/index.svelte [slug]/[category].svelte

Etc

There is a vscode extension that helps a little bit, but it's still the one thing I am not fond of.



What bothers me about it is that the routes and layouts have to live in the same hierarchy... Of course this is very usually OK, but layouts have an aspect of visual design while routes follow a logical organization. These are going to change according to different priorities and can be controlled by very different groups/people/authorities. There will be conflicts, and when that happens, you're going to be refactoring code (e.g. to factor out common bits to a component that can suddenly no longer live in the same layout) and moving it around.

The fundamental problem is that folders are now being used for two different concerns, which will inevitably lead to conflicts (and developer pain).

Edit: oops, you're actually talking about the removal of the option to have routes defined by a file, so that a route must be defined by a folder. I'm completely fine with that. I don't know why people complain about that. All the interesting routes end up with more than one file anyway, and who needs a special extra-simple way to organize the uninteresting routes, which are already simple?


The src/routes/posts/[slug]/+page.svelte thing is pretty recent, it used to be just src/routes/posts/[slug].svelte. I'm not exactly thrilled with the new naming...


I left the framework for this reason. When I asked about it, I was told "this is what Next will be doing soon". I need more reasoning than that, and it was indicative of the decision making process. Turned me off. Aside from that, Svelte is SUPER fast and easy to use. I may give it another go at some point.


I thought it was weird and couldn't see the reasoning, but personally I just persisted with using it and in the end I've found the new structure perfectly workable and perhaps even marginally prefer it. So yeh, it might seem stupid but maybe just try and use it more to find out if it's really that big of a problem for you. The rest of the gains I've had from SvelteKit were too good to pass up, it's overall just a superb dev experience.


Oh I'm still using SvelteKit. I just don't love having 3 or 4 +page.ts'es open in my editor.


More information about the reasons for the changes here:

"Fixing load, and tightening up SvelteKit's design before 1.0 #5748"

https://github.com/sveltejs/kit/discussions/5748




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: