laravel / jetstream

Tailwind scaffolding for the Laravel framework.
https://jetstream.laravel.com
MIT License
3.98k stars 822 forks source link

Pagination styles go missing in production #680

Closed stancl closed 3 years ago

stancl commented 3 years ago

Since the prod build of frontend assets uses PurgeCSS, it should be aware of Blade views that aren't in resources/.

Specifically, using pagination in Livewire works locally, but gets its styles purged in production.

This is sort of a bug report and sort of a feature suggestion. I think it'd be nice if the Purge config was aware of these views, but not sure which solution you'd want. Purge could look into vendor/livewire/livewire/... or Jetstream could just ship with the pagination view published.

Looking into vendor/ sounds like it could blow up in some setups, but I also don't want to unnecessarily add files to the repo. Maybe the Jetstream installer could call php artisan livewire:publish --pagination when the LW variant is used?

driesvints commented 3 years ago

I noticed this as well. This technically isn't a Jetstream thing but with Laravel itself. I'd also not call this a bug as you can solve this by adding the relevant path to the Purge CSS exclude list like we did here for Laravel.io: https://github.com/laravelio/laravel.io/blob/main/tailwind.config.js#L7

stancl commented 3 years ago

Hmm, so do you think that Jetstream should include similar PurgeCSS config?

The argument being that it's a preset which uses TW + Purge, so it should configure Purge in a way that makes sure it won't cause issues.

But I can see the counterargument that Jetstream does no pagination out of the box, so if the developer adds it, it's their responsibility to configure things properly.

Not sure what's the right solution, just some suggestions.

I can also see this just being mentioned in Jetstream docs (but then I can also see everyone missing that section).

driesvints commented 3 years ago

I think what we can do pragmatically is add the path here: https://github.com/laravel/jetstream/blob/2.x/stubs/livewire/tailwind.config.js#L4-L8 and here: https://github.com/laravel/jetstream/blob/2.x/stubs/inertia/tailwind.config.js#L4-L9 so it's at least solved for Jetstream itself. But for Laravel we'd need to either document it or assume it's the developer's responsibility.

taylorotwell commented 3 years ago

I agree Jetstream should add this to our purge configuration. Probably Breeze as well.

taylorotwell commented 3 years ago

Fixed in 2.2.1