2 ms·
I've seen alpinejs mentioned alongside LiveView, what benefits do you see to Stimulus over alpine?
by brainbag 3y ago
I've seen alpinejs mentioned alongside LiveView, what benefits do you see to Stimulus over alpine?
- sph 3y agoI've never used alpine, so I'm not the one to ask. I've just given it a cursory look a couple years ago. I do not like how it's trying to fit logic in custom HTML attributes. Doesn't look great to me, and would pollute my Liveview templates with a matryoshka doll of nested logic: There's a top-level Elixir module, which contains a HEEX string that creates HTML, which itself contains Alpine.js logic as an attribute. Feels cleaner to me to just create a new .js file that exports a controller, and just instantiate it from LiveView (which still pollutes the HTML, but much less than Alpine does) That said, there is no good or bad answer. Alpine or Stimulus are certainly better than instantiating Vue or React. HTMX could fit very nicely as well. Use what you're comfortable with.
- AlchemistCamp 3y agoI always avoided Alpine because it required allowing “unsafe-eval” in the Content Security Policy headers, which defeats a lot of the purpose.