Here is the step by step guide to create a React project with Vite.
- Run the command
npm create vite
in the command prompt. - Afer the script you will be prompted to enter a project name.
- After entering the project name, Vite will prompt you to select a framework. Select the framework as React.
- After selecting framework, Vite will prompt you to select language type.
- After selecting the language type, Vite will show the message as Scaffolding the project in the location.
- After that you can go to the folder and instruct to install the dependencies with the command
npm install
.
And here is the step to install Tailwind CSS as a Vite plugin.
Run the command
npm install tailwindcss @tailwindcss/vite
to Installtailwindcss
and@tailwindcss/vite
via npm.Add the
@tailwindcss/vite
plugin to your Vite configuration.import { defineConfig } from 'vite' import tailwindcss from '@tailwindcss/vite' export default defineConfig({ plugins: [ tailwindcss(), ], })
Add an
@import "tailwindcss";
to your CSS file that imports Tailwind CSS.After that you can run the project with command
npm run dev
or whatever command is configured in yourpackage.json
file..
What are your thoughts on this post?
I’d love to hear from you! Click this link to email me, I reply to every message!
Also use the share button below if you liked this post. It makes me smile, when I see it.