django_component + alpine-composition for Vue-like syntax and behavior #71
Replies: 1 comment 6 replies
-
That is a great idea. In fact, I was using django_components before and I think it's a great library. I had a journey through I think all Django-enabled frameworks, including Unicorn, django_component, django_components, djhtmx, reactor, etc. I must admit I dislike Javascript a bit because I am not good at it... So I happened to be the maintainer of Tetra - the whole bunch of heavy original work did Sam Willis, who is unable to continue working on the project due to lack of time. And to have Vue-like experiences in Alpine would be really a cool thing. At least I think that implementing Tetra's state logic into django_components would be a (too?) high effort - as Tetra's BaseComponent basically is the same as a d_c's component, without any state. Like I said, I don't have much experience in Js developing, I'm more the backend guy, and I am way more fluent in Python than in Js. So, whatever I can do to cooperate, I'l love to. |
Beta Was this translation helpful? Give feedback.
-
Hey, I'm one of maintainers on django_component, and I'm porting Vuetify to Django + Alpine (Working name Alpinui).
Such migration is possible, because Vuetify is built on top of Vue's reactivity system. ...And so is AlpineJS. So I rewrote all the Vuetify components, so the JS logic can be used both by Vuetify (Vue), and by Alpinui (AlpineJS).
To make the above possible, I made a few AlpineJS plugins, so that:
ref
,computed
,watch
, ...) inside AlpineJS components - See alpine-reactivityMoreover, over the past few months, we've also added features to django_components that make its templating close to on-par with Vue. There's scoped slots, provide/inject, etc. And soon also spread operator, expressions for prop values, dynamic components and slots, etc.
And so, I'm finally getting to the point - With the above setup, one can achieve much of what Vue offers. At the same time, I currently focus only on the UI / templating part of the stack. Things like making server calls from the client, or keeping server state, is outside of my scope. But that's where Tetra comes in.
So I'd love if Tetra could use the stack above, so users could have a full vue-like experience, while still being able to benefit from Tetra's server features. So like what NuxtJS is to Vue.
I didn't go thoroughly through Tetra's source code yet, so I'd be interested to hear how Tetra works, whether it somehow intercepts the django or alpine components. So I'd be thankful if you'd give me some pointers around.
Beta Was this translation helpful? Give feedback.
All reactions