Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 20, 2021 03:33 am GMT

So I tried Svelte and it was...interesting

When I first started writing my blog, I wanted to try something new. Im a big believer in doing what you know works for production, but still taking advantage of opportunities to try new things.

What is Svelte?

Svelte is a framework a la React and Vue. It uses a componentized approach just like those frameworks. However, it compiles down to plain JS with no runtime. That way its smaller. It also looks a lot more like plain HTML and JS rather than weird custom syntax (Im looking at your Angular). It also has first class support for animations, which some other frameworks (cough React) dont have.

However, there are some problems...

The build ecosystem and routing solutions are a bit of a mess and the maintainers keep changing their mind (despite being well intentioned).

For example, Svelte initially came with a CLI, then the maintainers switched to a format where they give you a template repo and you clone it via a custom tool called degit. They now want to move back to a CLI in a future release.

The recommended Svelte build tool is called Sapper. Its been deprecated in favor of a to be released build tool called Svelte Kit that is months and months delayed as of March 2021. Theyre also moving it to Snowpack for reasons? However even sticking with Sapper, I had a lot of obvious issues, like styling the body tag without triggering a Sapper warning. Build times for any non-trivial app can also get quite long using the webpack version of Sapper, which is something the maintainers acknowledge but cant fix until SvelteKit.

Additionally, one of the principles of the framework is to bind JS to the UI in a way that looks like normal JS. However, this can lead to some problems. You think youre looking at var a = "b" But its actually doing a ton of magic to watch the value that expression to update the DOM. So when it goes wrong. Its a little hard to debug.

Conclusion

First of all, this is just my opinion and this was my first attempt at using Svelte. However, chances are youre in the same boat, so I thought my insights could be valuable. Ive said a lot of negative things here, but I dont mean to rant. I really like Sveltes first class support for animations and the fact that it doesnt need to start up a runtime on the client to work. That means Svelte sites are generally fast after compilation. However, the ecosystem needs some more attention. It doesnt just need to be bigger but needs for the maintainers to stop using it for experimentation. If an idea is good at one point, it needs overwhelming reasons to change.


Original Link: https://dev.to/rvirani1/so-i-tried-svelte-and-it-was-interesting-3hh3

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To