Re:Stimulus: A modest JavaScript framework for the HTML you ...
by FrederikET on Friday February 23, 2018 @01:39AM
(#16444677)
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.
Re:Stimulus: A modest JavaScript framework for the HTML you ...
by nickjj on Friday February 23, 2018 @10:04AM
(#16446669)
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 ...
by J-H on Friday February 23, 2018 @12:22AM
(#16444417)
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.
Re:Stimulus: A modest JavaScript framework for the HTML you ...
by joshribakoff on Friday February 23, 2018 @12:38AM
(#16444475)
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 about webpack & vice versa. The key is to build components not a full fledged SPA. Pick either Rails or Vue router. If the former, Vue is just a component/view library, don't treat it like a framework.
Re:Stimulus: A modest JavaScript framework for the HTML you ...
by jrochkind1 on Friday February 23, 2018 @12:19PM
(#16447688)
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).
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, and when things start to get more complex I can easily break my dom out into components.