hotwired-laravel / turbo-laravel

This package gives you a set of conventions to make the most out of Hotwire in Laravel.
https://turbo-laravel.com
MIT License
795 stars 48 forks source link

Add new --alpine (or --breeze) flag to php artisan turbo:install #71

Closed misog closed 2 years ago

misog commented 2 years ago

Hi, Laravel Breeze (default setup) uses Alpine.js without Jetstream.

However there is just one documented way to make Alpine.js compatible in Turbo and that is with --jet flag.

A new --alpine flag could be added to make Alpine.js compatible with Turbo.

Specifically, this file should be injected with Alpine.js (ex. with Breeze (default setup) and without Jetstream) https://github.com/tonysm/turbo-laravel/blob/main/stubs/resources/js/libs/alpine.js

In general, each flag used by Laravel Breeze could be mimicked by php artisan turbo:install.

Or, just one flag --breeze could generate all files required for every Breeze setup (breeze default/alpine, breeze vue, breeze react, breeze with ssr). This approach would cover both two starter kits in Laravel: Breeze and Jetstream: https://laravel.com/docs/9.x/starter-kits

tonysm commented 2 years ago

I see. I like the --alpine option idea. I think there's room for changing a few things here. Maybe we could detect if the app uses Jetstream or Breeze (based on the composer.json) and update the templates accordingly... 🤔

I'll test this out.

tonysm commented 2 years ago

The new --alpine flag was added in 1.2.0