tailwindcss.com icon indicating copy to clipboard operation
tailwindcss.com copied to clipboard

Update Tailwind CSS integration example for Laravel

Open AhmedAlaa4611 opened this issue 9 months ago • 2 comments

Description

This PR updates the documentation to reflect the actual default integration of Tailwind CSS in Laravel as shown in the official Laravel repository.

Reason

The current Tailwind documentation for Laravel does not accurately reflect how Tailwind is integrated by default in the latest Laravel releases. This update ensures that new users following the guide get a setup experience that matches the actual Laravel boilerplate.

AhmedAlaa4611 avatar May 23 '25 06:05 AhmedAlaa4611

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 7:00am

vercel[bot] avatar May 23 '25 06:05 vercel[bot]

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';

The link pointing to the vendor folder makes sense; but if you're not using pagination - like me - it seems like an unnecessary guide, especially since the Laravel Docs specifically cover it in the Pagination section.

  • https://github.com/laravel/docs/pull/10238
  • https://laravel.com/docs/12.x/pagination#tailwind
@source '../../storage/framework/views/*.php';

When building, I'd rather exclude storage/framework/views than inject it - but that's a matter of personal relevance. If adding the views is truly important, it's justified by the .gitignore, as it does indeed exclude them, which causes automatic source detection to miss them.

  • https://tailwindcss.com/docs/detecting-classes-in-source-files#which-files-are-scanned
  • https://github.com/laravel/laravel/blob/12.x/storage/framework/views/.gitignore
@source '../**/*.blade.php';
@source '../**/*.js';

I didn't see much point in the other two either, since automatic source detection should handle all of them anyway. I see the point of these only if the source is disabled or specifically configured during @import. In that case, completing the paths is indeed useful. However, the docs recommend not doing that and instead using @import "tailwindcss"; on its own.

  • https://tailwindcss.com/docs/detecting-classes-in-source-files#setting-your-base-path
  • https://tailwindcss.com/docs/detecting-classes-in-source-files#disabling-automatic-detection

While explicitly adding these sources can indeed be helpful for beginners, I just wanted to share my thoughts on the matter here as well.

rozsazoltan avatar May 23 '25 08:05 rozsazoltan

Hello, @thecrypticace

AhmedAlaa4611 avatar Jul 09 '25 15:07 AhmedAlaa4611

Yeah ../../storage/framework/views being listed feels like a mistake especially since it relies on the views having been compiled / pages visited before that directory contains anything / everything.

Let me inquire about that.

thecrypticace avatar Jul 09 '25 20:07 thecrypticace

Alright, I got some clarification on this. There are some reasons to include compiled views in the app related to packages that register and use views but aren't directly used by the app.

thecrypticace avatar Jul 09 '25 21:07 thecrypticace