Live data from Hacker News

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

stimulusjs.org

21–30 of 65 posts

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

#21

This is good at first look. Because it seems to be straightforward and carefully design. I like the aesthetic and choice of using data attributes being part of the HTML standard as directives to apply the framework. One criticism I have relates to The syntax for denoting action methods. Did you agonize over the choice of syntax uses hash and implication? E.g. click->hello#greet All the same this careful choice shows…

I think the ”hello#greet” part is there to be consistent with Rails route mapping. As a standalone syntax choice, it makes little sense. But for a RoR developer, it’s obvious.

Cool, thanks for that :)

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

#22
post #12

Earlier quoted context omitted.

Pity that the end result is always having bower, webpack, npm, yarn, gulp, yeoman installed. Really painful when JavaScript is only used on the browser and the frontend files need to be integrated into the backend infrastructure written in a more sane language.

Why would a project have both npm and yarn, or bower, webpack and gulp?

Easy, each library is its own little world of dependencies, with the author favoring a different build tool, so simple npm install or npm serve might require all of them to satisfy all the dependencies build scripts.

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

#23
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.

Plenty of people have hand rolled crypto too. "Lots of people do it" doesn't always point to an actual gap in the available tools.

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

#24
post #22

Earlier quoted context omitted.

Why would a project have both npm and yarn, or bower, webpack and gulp?

Easy, each library is its own little world of dependencies, with the author favoring a different build tool, so simple npm install or npm serve might require all of them to satisfy all the dependencies build scripts.

Is that a real world scenario or something you can imagine but haven't actually done?

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

#25

Earlier quoted context omitted.

Support is now baked into most browsers for Web components! Also Polymer Lit-HTML and HyperHTML leverage JS Template Literals to natively update the DOM as fast or faster than virtual DOM using much less resource.

If you feel this is a lazy request please let me know, but could you point me to the source code for using native JS string templates to do Dom updating that achieve similar things to Virtual DOM?

https://github.com/Polymer/lit-html There are some unofficial (pre 1.0) benchmarks flowing around and it is VERY fast. Same goes for hyperHTML.

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

#26
We wrote a pretty similar (like similar enough its kinda creepy) library[1] a while back and it's really helped speed up our front end dev. I LOVE having params set in data attributes. Makes re-usable modules, like a modal[2] or autocomplete [3], way easier to implement.

[1] https://github.com/firstandthird/domodule [2] https://github.com/firstandthird/simple-domodal [3] https://github.com/firstandthird/complete

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

#27

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.

*Turbolinks, copy/pasted that for Google and didn't find anything relevant.

Edit: thanks, I found it, I was just pointing out to the typo so other people don't get confused.

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

#28
post #22

Earlier quoted context omitted.

Easy, each library is its own little world of dependencies, with the author favoring a different build tool, so simple npm install or npm serve might require all of them to satisfy all the dependencies build scripts.

Is that a real world scenario or something you can imagine but haven't actually done?

If you want a real world scenario, here is one

Polymer starter kit

https://github.com/Polymer/polymer-starter-kit

- npm

- bower

- polymer-cli

Doing a polymer test requires downloading and installing Web Component Tester, which then requires:

- npm

- grunt

- gulp

- bower

https://github.com/Polymer/web-component-tester

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

#30
post #26

We wrote a pretty similar (like similar enough its kinda creepy) library[1] a while back and it's really helped speed up our front end dev. I LOVE having params set in data attributes. Makes re-usable modules, like a modal[2] or autocomplete [3], way easier to implement. [1] https://github.com/firstandthird/domodule [2] https://github.com/firstandthird/simple-domodal [3] https://github.com/firstandthird/complete

I did two other frameworks that are super similar, hooked up with dynamic loading of the code with webpack, and the older one RequireJS.

It's a super awesome pattern, that makes things super simple and it's super lightweight as well.

Post reply on HN