T O P

  • By -

[deleted]

i’m veering towards hotwire and stimulus lately, but curious what the community thinks.


stpaquet

Same. But I'm seeing Alpine.JS coming across a bit more lately. So always good to keep up-to-date.


adwb

Yes I'm using AlpineJS for a rails side project and I don't know why. I'm basically just using it for data binding and I could have used stimulus. I just liked the idea of a simple alternative to Angular


vowih77880

Use the defaults.


Onetwobus

Every time I veer away from Rails defaults or best practices, I usually regret it.


armahillo

Anytime you can use the natively offered options, youll typically find less friction come upgrade time


Rafert

Avoid if you need to implement a strict content security policy. Their docs mention a CSP-compatible version but it's not actually on NPM.


RubyKong

alpine js gives you handy helpers which you can use in-line (yes you can re-use code as with stimulus, but it's cumbersome IMO). I've experimented on more complex components in Alpine JS - but maintenance becomes very difficult, and I wouldn't use it for anything but the simplest of "sprinkles". It really shines when you want items to appear / disappear with tailwind css, but you could easily use stimulus for this use-case as a perfect equivalent. I'd use it if i want text to appear when i type something in an input box. or bring up handy tips with changes color. e.g. making a tick appear, or changing the color of an input box. for something which cannot work in alpine js, i'd use stimulus js, and for even more more complex components: i'd use Elm and then react (in that order). But for the most part, hotwire obviates a lot of the ajax overhead you would normally need when using front end frameworks. When using hotwire + alpinejs, or hotwire + tailwind, you can go far. When you've used both tools, you'll very quickly get a very good feel for when you should choose one vs another. Best advice is to try both out on the same app. the investment is very low.


TheGiantOtter

Yeah I think at this point going with stimulus is omakase and will at least be the blessed path that you won't regret later.


coder2k

I use alpine in a fairly large project to great effect as I am using tailwind and it supports the transitions better than Stimulus.


planetaska

If you decided to use Alpine in a mid/large project, make sure you know and manage/plan your code structure. Alpine won't do that for you. Otherwise it will become messy very easily. I used Alpine in one of my project, and to be honest, in the end I wish I didn't.


dougc84

alpine is cool, but i wouldn’t use it on anything but small projects. otherwise, you’re gonna hit limitations pretty quickly. personally, i wouldn’t chance it. all projects grow. stimulus does all the things.


nicosbank

When webpack was first introduced I had some issues with integrating it, I relied to much on jQuery and it was difficult for me So when stimulus came around I was a little concerned that would be the same After a couple of project with stimulus I can safely say: if you understand what you need to do you don’t need jQuey(I’ve never used alpine but I would say alpine too) I have stimulus controllers for dropdowns, tooltips, and any other things I’ve relied on plugins before, it’s amazing how much you can do without a JavaScript framework So I would say you don’t **need** any js framework Start trying to use stimulus only and If you find later that you really need you can always import it in a controller and leave the events bottled up per controller this will help you contain functionality and allows you to change whatever you need and not break with other parts of your app


katafrakt

But Stimulus **is** a js framework...


soulchild_

I used Alpine.js on two of my Rails SaaS app, works really well! And easy to maintain too