An HTML over-the-wire plugin / Magic function #3709
Replies: 3 comments 4 replies
-
I do have a plugin that offers a bit of this functionality https://www.npmjs.com/package/@ekwoka/x-ajax That being said, in projects I've needed to do this I've used some different code, but that was broadly for larger "replace whole main section to be a different page" contexts, usually relying on Alpine morph most of the time except for components that didn't play nicely with being morphed. This kind of functionality will almost definitely not be added to Alpine core, as Alpine is primarily made to work with Livewire so the core wouldn't include things not relevant to that case. |
Beta Was this translation helpful? Give feedback.
-
Added some more swap styles and outerHTML uses Alpine.morph if it's available. https://github.com/james0r/slayed/tree/main/src/alpine/plugins/wire |
Beta Was this translation helpful? Give feedback.
-
Kinda reigned in my ambitions with this thing and renamed it $swap. Figured out they were using |
Beta Was this translation helpful? Give feedback.
-
I've tried Htmx and as cool as it is I find I don't need most of it. I have a simple helper function that I use to fetch some html and swap things out but I think it would be super cool if there was A) either a core helper for this or b) a solid plugin handles swapping and possibly more.
I just made a little proof of concept that is super minimal and probably unsafe but hopefully shows what i'm looking to do:
Usage:
The last argument would be the swap method that I've yet to implement.
Be curious to hear some thoughts on this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions