The Origin of Stimulus JavaScript Framework
stimulusjs.org
stimulusjs.org
It makes JS enhancements/sprinkles so much easier to implement. Stimulus is a step in the right direction from jQuery hell but not a fully loaded client-side rendering framework.
I've done a lot of React/Angular/Vue in the past. Stimulus is a much more light handed approach that I really appreciate as a developer -- less duplicated logic and common sense defaults. Dead simple to pick up.
For content based sites, Stimulus is a much better tool IMHO.
But... it hit a point where Vue.js was just so far superior to our own inhouse framework, that any interface that needs highly interactive component get's Vue now. Since Vue can run as a script file (hoping it gets the full ES module treatment soon) then we can splash it around anywhere in the interface we want, just like jQuery and our custom framework.
Now our system is like this: SSR > Full page > Vue app/vanilla js tweaks.
Updates are: AJAX/fetch a block of HTML into an element, and it can be a full Vue app, or just a block of content.
It's interesting to see that Basecamp ran into the same problems we did and didn't find that the full-on SPAs everywhere was the right solution for them. It's a nice bit of confirmation that there are many different ways to solve a problem that are valid.
There are indeed many different ways to solve these problems. My biggest criticism with the Stimulus documentation here is that it feels so disparaging of other people's solutions.
In many ways, I wouldn't expect less from Basecamp. Superiority and self-righteousness seems ingrained into basecamp's culture.
This year he raged against the Twitter war that was waged on Foo, Bar and Baz
https://m.youtube.com/watch?v=cBFuZivrdT0
Lots of DHH ideas are take or leave. The consensus seems to be that you need to wait a while before embracing new features in Rails, because they are often released half-baked and frequently no good until the second try. (Take credentials for example, or turbolinks.)
That being said I am really interested in Stimulus, as based on the promotional pages at least, it seems like it is not very big and it would be hard to do wrong. I haven't "bit" for any JavaScript framework yet since jQuery, and consequently all my JavaScript is pretty terribly disorganized. It is very encouraging that this has made it to 1.1 without any apparent major overhauls!
https://github.com/krasimir/react-bare-minimum
When I was able to get it working, it came out to 880kb. That's more than (nearly) 600kb! I thought you were exaggerating.
The stimulus umd.js by comparison is 60kb uncompressed.
React makes sense for something like Facebook/Instagram web where users interact with the app hundreds of times in a single session, but we can't fall into the trap of treating it like jQuery and hitting every nail we come across with it.
I'm hopeful that like jQuery, whatever features that make ReactDom et al. so large will eventually make their way upstream and be codified as browser specs.
Comparing apples more to apples, while the react-dom.development.js is indeed ~600 kbs. The minified production build of react-dom is only ~70 kbs [1], which is is smaller than jQuery minified (but not gzipped) [2].
It's not necessarily React itself that is bloating these project sizes.
[1] https://github.com/facebook/react/releases [2] https://mathiasbynens.be/demo/jquery-size
That being said, I think I've seen this before... is it being posted today because it's interesting, or because something is new about it?
edit: ah... linked from the front page[1]
v1.1.0 - @sstephenson sstephenson released this 19 hours ago
[1] https://github.com/stimulusjs/stimulus/releases/tag/v1.1.0
Glad to see this mentioned.
Hopefully legions of devs can least now UNDERSTAND why SPA can be faster & what makes it so.
I can't remember ever seeing one of the fundamental reasons explicitly being called out..leading to vast amounts of devs never truly grasping the why of 'why are SPAs faster'.
The article was about not doing a SPA, so I was confused.
Yes, they found a way to extract the part that makes SPAs fast and applied it to their legacy code-base.
My idea of SPAs performance gain was mainly that they didn't send HTML, but JSON, which I cosindered vastly smaller.
(e.g. me opening GMail in Indonesia and never being able to load it)
I dislike the general SPAs are faster "truth". They might, they might not and the initial load can be just too much. You can sure spend time to optimize SPA to perform well though. Btw Turbolinks tries to solve this "do not parse JS again" thing and it's where the speed comes from.
Tad condescending there...
Why?