HTMX + Alpine.js + TailwindCSS

This commit is contained in:
Akira Tempaku 2024-04-25 21:08:56 +09:00
commit d614f039d3
37 changed files with 114 additions and 233 deletions
public/vendor/htmx-ext

View file

@ -0,0 +1,16 @@
htmx.defineExtension('alpine-morph', {
isInlineSwap: function (swapStyle) {
return swapStyle === 'morph';
},
handleSwap: function (swapStyle, target, fragment) {
if (swapStyle === 'morph') {
if (fragment.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
Alpine.morph(target, fragment.firstElementChild);
return [target];
} else {
Alpine.morph(target, fragment.outerHTML);
return [target];
}
}
}
});