What's new in Svelte (Dec 2020)
svelte.dev
svelte.dev
Wait, is this thing entirely client-side, in only 17.5 KiB? I know browsers can capture video frames, but how does it export it afterwards?
[0] https://developer.mozilla.org/en-US/docs/Web/API/MediaStream...
Export code is here: https://github.com/mattorchard/vippet/blob/master/src/helper....
Seems like MediaRecorder (https://developer.mozilla.org/en-US/docs/Web/API/MediaRecord...) is the standard API to record the screen, it takes a video format during setup, and then `recorder.requestData()` will give you the raw bytes for your format of choice when you're done, ready to download and save or do whatever with. Web standards do a lot of heavy lifting for you nowadays!
The entire app bundle [1] is roughly the size of a library adapter like react-redux [2], which is just glue code.
[1] https://vippet.netlify.app/build/bundle.js
[2] https://unpkg.com/react-redux@7.2.2/dist/react-redux.min.js
As a point of reference, just this week I saw someone on Observable experiment with WASM-compiled encoder packages for that exact reason[0][1].
Svelte seems really nice and lean though, I do agree with that
(And also ts-liveview is inspired from s-js and Phoenix Liveview)
Anyone use it then go back to the traditional frameworks? Anyone love it and still think it’s the next big thing?
https://undefined.fm/radio/vue-vs-svelte-with-evan-you-and-r...
> The UI component libraries for Svelte are still lacking in maturity
The typical counterargument usually made at this point would be "those two points are related" (to paraphrase Bjarne Stroustrup: "every ship gets barnacles as it ages").
So let's anticipate that: do you have any reasons to believe that Svelte will avoid adding accidental complexity/verbosity to it as it/the surrounding ecosystem matures, and if so, how do you think that will be mitigated?
Enough time has passed to firmly conclude that Stroustrup was wrong on that point. Other languages have withstood the test of time better than C++<11 and C++>=11 has dramatically improved the language by copying features from those other languages. C++'s issues were poor design choices, not simply some "maturity" force that causes a language to accumulate incoherent features.
The maintainers are very paranoid about adding complexity, and are not being funded by large corporations paying for features to get added.
The initial pages are Go templates which are hydrated with Svelte components. It took a bit of trial and error to get the flow right so that I don't have to write double the code.
I don't know if it's the next big thing or not but it works really well for me.
What is the advantage of doing this over using http.FileServer to serve html which imports your svelte generated javascript directly ?
Are you using Svelte in a part of your application instead of the entire application?
Maybe there's a better way to do it, but I like writing smaller components that can replace initial server-rendered HTML, and can then be imported into larger components.
The ecosystem isn't there yet, and I probably wouldn't try to use it in a work project. For my personal projects though, I use it for everything front-end. More than that - I've stopped making desktop apps and just default to using svelte instead.
Happy to answer any specific questions you've got! Bottom line - given the opportunity, I will use Svelte.
I'm a web developer and I like the power and flexibility it has compared to native GUI development but I think a big problem is we now have an entire generation that doesn't even know what they're missing.
I'm guessing that the Windows and MacOS frameworks were less hostile, but it seemed like the web was surely ideal, at least in the last several years. Sure, you had to learn a web framework to build simple applications, but you could at least use a high level language with a reasonably sane package manager (for those who haven't developed in C or C++, it might come as a surprise that JavaScript and NPM are "sane" tools) and a reactive programming model.
I guess I'm not sure if my expectations for web development are too high or if GTK and Qt are especially bad representatives of native development.
I echo this sentiment, with the exception of Delphi circa version 5-7, though that's probably through rose-tinted glasses since I had just come off trying to make Win32 UIs using MASM. GUI development has always been a crapshoot of learning esoteric bugs masquerading as features. Windows and MacOS UI development is no different, just more locked in. At the very least the web is somewhat consistent between platforms.
Svelte has been around for "a while" and seems to be hanging around and people are enjoying it.
I'm still really comfortable with React, and would love to know how people have found the transition between the two and how Svelte compares.
I also get the feeling that the Svelte maintainers do not particularly care what the community wants and are building what they want, which is totally cool, but unfortunately I disagree with a lot of their choices so I guess it's not for me.
The JS ecosystem’s penchant for giving you small components that you have to choose individually and then glue together can get a little exhausting. Hopefully the library whose approach you prefer has decent documentation, keeps up with changes to svelte, doesn’t get abandoned, etc.
Edit: apparently Sapper is a Next.js like framework that provides all the components you need for svelte in one package. Someone else said on this thread it’s eventually getting deprecated by the svelte team’s own thing called SvelteKit. Not ideal, but at least they’re working on something more integrated.
I've used React, HyperApp and Flutter and Svelte (with Tailwind for CSS) is in my opinion clearly superior. But I also know someone who thinks Flutter is better.
I love it and will slowly be replacing my React/Vue/(old angularJS) projects with it.
The nice thing is, you can read the entire docs and just follow the interactive tutorial in a few hours and get up to speed incredibly fast.
We have faced the usual wild west frontier situations where nobody really had an answer for something we wanted to do, but we have worked out solutions without a huge deal of frustration.
And it's important to mention that the development and maintenance experience of Svelte is very pleasant.
Looking forward to SvelteKit - I don't care for TS though.
As it is kind of a hobby project, might as well learn the next hot thingg? Is Svelte suitable for these kind of applications? Some of the features of nuxt.js that i like: content module (put some markdown files in a folder and the routes, write a template and then all the html rendering etc is all taken care of) extensions for image resizing so images are resized to multiple resolutions as part of the build process, hot reloading in development
npm init svelte@nextSo basically it's possible, put you have to put the thing together by yourself.
Anyway adding proper support for TS sealed the deal for me - Svelte itself might never reach mainstream adoption but the idea of having a framework-compiler is something that I hope will, since it retains all the advantages of alternative approaches without introducing any significant disadvantages.
Off the top of my head there's also "strong", as in "the type system is sound" or "not allowing pointer arithmetic".
It's not that clear cut.
It might be worthwhile to frame it as "static and strongly¹ typed" with a footnote expanding on what "strongly" means to the svelte developers, just to get everyone to agree what we are even talking about in the first place.
I think the confusion around the term mainly arises from people in computer science having a strong ;) preference for binary definitions. To be able to say "X is strongly typed" and "Y is not strongly typed" is desirable.
However, linguistically, "strong" and "weak" are not binary terms. Static is: something is static or is not. But strength/weakness is an assessment on a scale. Defining something as "strong" is always, by definition, relative and somewhat subjective in nature.
That isn't to say that the definition of "strongly typed" is subjective; we can find agreement on what scale "strong types" live upon. But the application of the term to any given object is subjective. We cannot say "X is strongly typed", we can only say "X is more/less/very/not very strongly typed".
I agree with your overall argument, but in this conclusion I subtly disagree: it implies that we could come up with some linear quantitative scale from 0 to 1 of how strongly typed something is. I don't think we can, it's a composite of qualitative features that defies that approach.
It might even be a somewhat rock-paper-scissors like kind of thing where also we cannot really value each feature because their positive or negative value greatly depends on the presence or absence of other features.
Typescript is statically typed but it is also weakly typed. Types are validated at compile time, but they do not prevent you from using invalid types at runtime.
In short, we have a plethora of frameworks for the same reason we have a plethora of languages, sodas, beers, coffees, tools, products, novels, etc. Humans are messy.
While it may seem a plethora of frameworks exist, a few have most of the market share. That is not too far from the situation with other programming languages and framework types.
There are also old frameworks that have essentially been obsoleted but continue to stick around due to project inertia, the needs of legacy code, or marketing needs of the maintaining organizations.
Different strokes for different folks. People are trying to make new things that solve what they think are pain points in previous approaches.
There really isnt "so many" frontend frameworks. React is the clear leader, with Vue and Angular trailing behind. Svelte is a bit more of an experimental/innovative thing.
1. Open standards. There is no one entity to control what frameworks are "standard". Need for back compatibility of the web standards make them too simple and minimalistic. So you inevitably have a demand for power tools.
2. Many players are trying to capture demand for power tools. Of course their reasoning and approach differ. Often it becomes less about technology, but more about audience perception of the tool. Then we see more blogposts, podcasts, meetings, "see how easy to create and app" posts.
3. Web frontend is hard environment to model UX because too many moving parts. You have inherentedly stateful programm which should communicate asynchronously with at least 2 inputs-outputs: web server and user. Not speaking that it's not enough to have framework with proper building blocks to model your UX, you have bunch of issues with dependencies, debugging and integrations with existing tools.
This makes hard to come up with a solution which can satisfy many people. Some people are infiltrated with ideas which are incompatible with particular framework ideology, and bam, you have 2 camps which "push" against each other.
Now you have demand for tools, but tools shitty in some ways, and it's shitiness is covered with hype, brands and other forms of forming opinion.
This creates a demand for a new thing after people get disillusioned via own experience. And we get yet another framework. Repeat every 4-5 years.