Accudio / async-alpine

Async Alpine brings advanced code splitting and lazy-loading to Alpine.js components!
https://async-alpine.dev
Apache License 2.0
149 stars 12 forks source link

Allowing to inject components inside <template> #42

Open jgauna opened 3 months ago

jgauna commented 3 months ago

Hi. Here's the thing

I have two ways of displaying the same component (desktop and mobile), so my initial thought was:

<template x-if="isMobile">
      <div
        id="componentOne"
        ax-load="event"
        class="contents"
        x-data="componentOne()"
        x-html="view"
        x-ignore
      ></div>

      <div
        id="componentTwo"
        ax-load="event"
        class="contents"
        x-data="componentTwo()"
        x-html="view"
        x-ignore
      ></div>
</template>

But this willl result in loading just the "componentOne". Then I thought "one