Closed Aluzja closed 3 years ago
It makes sense for angular because you create three files (by default) and connect it to a module and need some boilerplate. With Svelte you create a new file and you are done. I don't see the DX enhancement here.
One potential benefit I could see is creating a starter page template with a load
function, but this still seems much better suited to a 'snippets' thing at the editor tooling level.
Snippets are a neat idea. What possible snippets could be of use?
My thought is that the command would add the file and any of the initial boilerplate (admittedly small) with Svelte to get up and running on a new component or route.
A new route command would allow you to enter the path, create the folder then the file(s) below.
I agree it’s not as big of a deal as Angular.
Relying on editor snippets puts more on the developer to add the snippets after installing sveltekit, where as if it’s part of the CLI it’s given with the install.
On Sat, Apr 17, 2021 at 5:52 AM Simon H @.***> wrote:
Snippets are a neat idea. What possible snippets could be of use?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sveltejs/kit/issues/1063#issuecomment-821818078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYWF3PAOQJ3HVXZ6JVWDMTTJF77FANCNFSM43CVUSBQ .
I'm not sure what a snippet could possibly contain — the script and style are both optional, and there's no valid assumption we could make about the markup.
So we're talking about a command to create a single empty file. That already exists! It's called touch
. I'm not sure I understand the value proposition!
Fair points!
something like:
svelte create-route xyz
it create the following files
route/xyz/ +page.svelte // have all 3 tags script, html, style ... maybe have a simple counter +page.server.js // have load function and an action +page.js // have csr, ssr export etc
this can be expanded to create component boilerplate as well
Is there an existing third-party CLI that covers this?
Is your feature request related to a problem? Please describe. Not a problem, just a QoL enhancement.
Describe the solution you'd like Similar to Angular's 'ng g c' to create a new component with right files / folders / boilerplate ready to go, add this functionality to the svelte-kit cli for components and routes.
Describe alternatives you've considered Doing it by hand ... I mean come on, we're programmers, why do things manually?
How important is this feature to you? Important enough that I'm creating a feature request to start some dialog as I dig into the source code and look at adding it myself. ;)
Additional context