$ npm install -D tailwindcss postcss autoprefixer $ npx tailwindcss init -p
tailwind.config.js
/** @type {import('tailwindcss').Config} */ export default { content: [ "./resources/**/*.blade.php", "./resources/**/*.js", "./resources/**/*.vue", ], theme: { extend: {}, }, plugins: [], }
resources/css/app.css
@tailwind base; @tailwind components; @tailwind utilities;
routes/web.php
Route::view('example', 'example');
resources/views/example.blade.php
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @vite('resources/css/app.css') </head> <body class="bg-gray-400"> <h1 class="text-3xl bg-red-500 font-bold underline"> Hello world! </h1> </body> </html>
$ npm run dev
http://localhost/example
There was an error while loading. Please reload this page.