jonassiewertsen / statamic-livewire

A Laravel Livewire integration for Statamics antlers engine
83 stars 14 forks source link

Undocumented step required when using livewire:scriptConfig tag #59

Closed godismyjudge95 closed 3 months ago

godismyjudge95 commented 3 months ago

Found out the hard way that if you need to compile the Livewire assets separately (ie. to add an Alpine plugin) there is one additional step required.

I had assumed that by using the {{ livewire:scriptConfig }} tag the livewire forms script would be included. However that appears to only set up some preliminary config variables.

I was able to get the forms working again by adding the following to by site.js:

import { Livewire, Alpine } from "../../vendor/livewire/livewire/dist/livewire.esm";
import "../../vendor/aerni/livewire-forms/resources/dist/js/livewire-forms";

window.Alpine = Alpine;
Livewire.start();
marcorieser commented 3 months ago

@godismyjudge95 The Readme already tells you to bundle the scripts yourself by pointing to the Livewire docs: https://github.com/jonassiewertsen/statamic-livewire/blob/7261f748004a49bcc2febb1460525ca843bfa040/README.md?plain=1#L35

But maybe that's not clear enough. Could you open a PR with the desired changes?

jonassiewertsen commented 3 months ago

Thanks for the information, I think that others might feel the same.

So I am looking forward to your PR as well.

godismyjudge95 commented 3 months ago

I'm so sorry, I posted this on the wrong repo 😅 I meant to post it on the Livewire Forms repo: https://github.com/aerni/statamic-livewire-forms