Thanks for the great post 👍 The SvelteKit approach looks really neat.
A Svelte-noob question about the folder structure: why some files are in src/..., some in src/lib/..., some insrc/routes/...` (incl. the form component) and some in the root? Is it intentional and reflects some common practices in Svelte, or it's just for the showcase purposes?
Thank you) Svelte kit uses file names as route paths, therefore all the routes need to be in the src/routes folder. E.g. if you would like to render a page /blog/some-nice-title you would create a /src/routes/blog/some-nice-title.svelte. Same goes for the .ts ( or js) files with method handlers exported.
And the lib folder is conveniently aliased to avoid imports from ../../../../../src/lib/file.ts, so that you could simply import $lib/file.ts
Thanks for the great post 👍 The SvelteKit approach looks really neat.
A Svelte-noob question about the folder structure: why some files are in
src/...
, some insrc/lib/..., some in
src/routes/...` (incl. the form component) and some in the root? Is it intentional and reflects some common practices in Svelte, or it's just for the showcase purposes?Thank you) Svelte kit uses file names as route paths, therefore all the routes need to be in the
src/routes
folder. E.g. if you would like to render a page/blog/some-nice-title
you would create a/src/routes/blog/some-nice-title.svelte
. Same goes for the.ts
( or js) files with method handlers exported.And the lib folder is conveniently aliased to avoid imports from
../../../../../src/lib/file.ts
, so that you could simply import$lib/file.ts
Hope that helps:-)
Cool, very neat 🔥