Live data from Hacker News

Stimulus: A modest JavaScript framework for the HTML you already have

stimulusjs.org

51–60 of 65 posts

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#51

Earlier quoted context omitted.

Is there anyway to use turbolinks with a java backend? Or is it only specific to rails?

You can. Here's a blog post from somebody who uses it with an Elixir backend. https://changelog.com/posts/why-we-chose-turbolinks

Turbolinks also works really well for static sites because all you have to do is drop in the Javascript and use it.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#52
post #46

Earlier quoted context omitted.

30KB? That's a lot, this is not minified and Gzip'ed is it?

Well, I just opened the script in firefox and checked the network tab in the dev console. It's 26KB gzip and 31KB after decompression. Which, IMO isn't too bad, I keep my pages under 100KB. If I throw out a picture for an older project, I can easily get back those 30KB to stay under 100KB.

stimulus.umd.js is ~5.3KB gzip'd

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#53
post #8
post #7

As a VanilaJS advocate, I love it. The manual even describes how to use just a plain inclusion, instead of the build tool of the day.

But...tons of the nontrivial JavaScript projects I use describes a plain inclusion. So I don't quite understand the plaudit here. Doing so is not a great idea , because build tools solve real and extant problems, but they're very common.

A lot of tools solve real and extant problems, but that doesn't mean they should always be used.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#54

I like it a lot, but I'm always afraid that I'll end up running into limitations of the framework if whatever I'm doing happens to grow in scope in a way I hadn't planned for. I tend to be bad at planning ahead for side projects, but who can blame me, they're side projects. Anyway, just stopping by to say that Vue has struck a good balance for me. Peppering in {{template values}} in existing HTML works really well, a…

Have it exactly the same way, and especially the vue components are nice to have. It seems like Stimulus would be a good fit for small applications, but as soon it becomes a medium size project it would be to complex to maintain.

From what I've read from DHH, Stimulus was extracted from real world usage in Basecamp which I think is safe to say a lot bigger than a small project.

They didn't just "invent" the library in hopes it would work for someone. It's what they run in production on one of the most long running SAAS apps on the internet.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#55
post #18

I don't mean to knock the effort they've put in here, but this looks like all of the hand-rolled "frameworks" I saw my friends in the agency / consulting space made when they said angular 1 was "too heavy"... right down to the 'data-controller' attribute binding that everyone seemed to independently come up with. Is there anything actually novel here? These types of things always seemed to run into composition issues…

Isn't the fact that you've seen a bunch of people already hand-roll this a good indication that there's a need for something like this, so no-one else needs to hand-roll it anymore? It doesn't need to be novel right? It just needs to be helpful.

I tried to address that gently in my second paragraph. Every one of those were abandoned. The most complete one's developer said "what the hell was I doing?" onve he finally gave angular 1 a shot.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#56

Previous discussion: https://news.ycombinator.com/item?id=16052105 I've been using Stimulus + Turoblinks for my current side project and I love it. Nice and simple way to add a bit of interactivity to existing HTML on your page.

Is there anyway to use turbolinks with a java backend? Or is it only specific to rails?

Allow me plug something. If you just want to "AJAXify" a few links and forms you could try the splice-into behavior from this repo:

http://quickenloans.github.io/Behaviors.js/

It has no server-side dependencies and should be easy enough to use. But it doesn't use push history, which limits its usefulness for more extensive use cases.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#57
post #46

Earlier quoted context omitted.

30KB? That's a lot, this is not minified and Gzip'ed is it?

Well, I just opened the script in firefox and checked the network tab in the dev console. It's 26KB gzip and 31KB after decompression. Which, IMO isn't too bad, I keep my pages under 100KB. If I throw out a picture for an older project, I can easily get back those 30KB to stay under 100KB.

>It's 26KB gzip and 31KB after decompression.

Yeah so no. There is no way gzip could only compress 16% of utf8 data.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#58
post #4

Earlier quoted context omitted.

I love Vue as well. The problem is that I haven’t found a good way to fit Vue in with an existing Rails app without it resorting to JavaScript hell. Stimulus looks interesting because it already fits in with Turbolinks.

When you say JS hell I'm assuming you mean because Rails wants to be your JS bundler? Why not just have rails output a div with an ID? And then use a separate bundler such as webpack to generate a JS bundle? At the end of the day Vue-cli or create-react-app ultimately just generates static assets. Adding your statically built SPA into a Rails app should be no harder than adding jQuery. Rails should not need to know a…

Of course, Rails 5.1+ supports webpacker better too, which I believe is recommended/intended for use with stimulus+Rails too (to get the es6 in the example, for instance).

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#59

I don't mean to knock the effort they've put in here, but this looks like all of the hand-rolled "frameworks" I saw my friends in the agency / consulting space made when they said angular 1 was "too heavy"... right down to the 'data-controller' attribute binding that everyone seemed to independently come up with. Is there anything actually novel here? These types of things always seemed to run into composition issues…

Honestly I don't know why I'd want Stimulus over regular old web components if I wasn't going to use a whole library like React. It doesn't look like it adds much beyond what web components already give you.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#60

Previous discussion: https://news.ycombinator.com/item?id=16052105 I've been using Stimulus + Turoblinks for my current side project and I love it. Nice and simple way to add a bit of interactivity to existing HTML on your page.

Is there anyway to use turbolinks with a java backend? Or is it only specific to rails?

I don't think Turbolinks is a good idea from a usability standpoint. Too many UIs have a similar bar at the top, and they mean different things: a browser's loading bar, a website's loading bar, a website's read-progress, etc. I think it increases the user's cognitive load (at least for this user) to figure out which kind of bar it is and why the top of the page is animating.

Turbolinks also makes websites appear extremely slow when on slow connections. It's much more frustrating to sit there with a loading bar hovering at 20-30% than to see a spinner.

Post reply on HN