I think it would be better if you put the <script> tag at the top, as it would make it easier to know where the variables comes from. And also, this is good :)
Hm, that's a fair point! Since Svelte builds everything down to a bundle it shouldn't be a performance issue to put the <script> at the top. However, I tend to read code from the markup first, then dive into the functionality if need be. Personal preference more than anything 🤷♀️
I'm doing Maximilian's Svelte course, he puts script section at the top and it does look nice. He uses npm and only for CLI to get rollup to build and to start dev webserver. Highly recommend him and his course - on Node too.
I've taken that course too. It covers everything. The one gripe is that when it comes to Sapper, he refactors the existing pure Svelte SPA cours project, which I can't follow. Better would be a tiny program in Svelte/Sapper.
Other than that, the course is well worth the $12 for lifetime access.
You can find it on udemy.com.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.