How to Install Tailwind CSS in Laravel 9?

https://www.itsolutionstuff.com/post/how-to-install-tailwind-css-in-laravel-9example.html

How to Install Tailwind CSS in Laravel 9?

By Hardik Savani May 20, 2022 Category : LaravelPauseUnmuteLoaded: 3.66%FullscreenVDO.AIHi Dev,

In this post, we will learn laravel 9 install tailwind css. I explained simply step by step install tailwind laravel 9. In this article, we will implement a how to install tailwind css in laravel 9. let’s discuss about how to install tailwind in laravel 9.

Tailwind is a CSS framework like bootstrap. using tailwind css use can create responsive website design. In this post, i will give three ways to install tailwind css in your laravel application. you can see below list:

1) Install Tailwind CSS using npm

2) Install Tailwind CSS using Breeze

3) Install Tailwind CSS using Jetstream

So, let's follow below step by step to install tailwind css in laravel application.

1) Install Tailwind CSS using npm

In this step, i will give you list of steps using npm command. so let's follow it.

Step 1: Install Laravel

If have not already setup of laravel application then you can run below command to get fresh laravel app:

composer create-project laravel/laravel example-app

Step 2: Install Tailwind CSS

Let's install tailwind css with dependency and create tailwind.config.js file. so run below command:

npm install -D tailwindcss postcss autoprefixer  npx tailwindcss init

Read Also: Laravel 9 Authentication using Jetstream Tutorial

Step 3: Configure Template Path

Here, open tailwind.config.js file and add files path there:

tailwind.config.js

Step 4: Add Tailwind with Laravel mix

Here, open webpack.mix.js file and add lines there:

webpack.mix.js

Step 5: Add Tailwind CSS in app.css file

Here, open app.css file and add lines there:

resources/css/app.css

Step 6: Install npm and Build

Run "npm install" command and then build it with "npm run watch" command:

Build npm process:

Step 7: Use Tailwind CSS in App

Now, you can use tailwind css in your blade file as like below:

resources/views/welcome.blade.php

Let's see below output:

2) Install Tailwind CSS using Breeze

In this step, i will give you list of steps using npm command. so let's follow it.

Step 1: Install Laravel

If have not already setup of laravel application then you can run below command to get fresh laravel app:

Step 2: Install Breeze

Let's run bellow command to install laravel breeze package by bellow command:

Next you have to install laravel breeze for simple auth scaffolding. so let's run bellow command:

Now let's run bellow command for install npm:

That's it. you will have setup on tailwind css based.

3) Install Tailwind CSS using Jetstream

In this step, i will give you list of steps using npm command. so let's follow it.

Step 1: Install Laravel

If have not already setup of laravel application then you can run below command to get fresh laravel app:

Step 2: Install Jetstream

Now, in this step, we need to use composer command to install jetstream, so let's run bellow command and install bellow library.

Read Also: Laravel 9 Authentication using Jetstream Tutorial

Step 3: Create Auth with Livewire:

now, we need to create authentication using bellow command. you can create basic login, register and email verification. if you want to create team management then you have to pass addition parameter. you can see bellow commands:

Now, let's node js package:

let's run package:

Read Also: Laravel 9 Contact US Form with Send Email Example

That's it. you will have setup on tailwind css based.

I hope it can help you...How to use Google ReCaptcha V3 in Laravel 9?

Last updated

Was this helpful?