😀Dùng Tailwind v4 (ok)
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body>
<div id="app">
<main class="py-4 mt-5">
@yield('content')
</main>
</div>
</body>
</html>
✅ Setup chuẩn Tailwind v4 + Laravel + Vite
1. Cài đúng packages (QUAN TRỌNG)
2. Sửa postcss.config.js (BẮT BUỘC)
postcss.config.js (BẮT BUỘC)3. File resources/css/app.css (đúng v4)
resources/css/app.css (đúng v4)4. vite.config.js (giữ đơn giản)
vite.config.js (giữ đơn giản)5. Import CSS vào JS
6. Blade
7. Restart dev server
🔥 Debug nhanh (rất quan trọng)
Test class
Nếu KHÔNG hoạt động → check:
❌ 1. Sai plugin PostCSS
❌ 2. Sai path @source
@source❌ 3. Chưa import CSS vào JS
❌ 4. Cache Vite
⚠️ Lưu ý cực quan trọng về Tailwind v4
✅ Kết luận
Last updated