Vite is a new building tool how improve the developer experience for development with the local machine and for the build of optimized assets for production.
Initialization Application
Setup Application
You can use the scaffold to setup the Vite app, with React templates.
The following command will:
Vite is installed and ready to use, let take a look in package.json
file.
Here is the default NPM scripts in a scaffolded Vite project:
Next step run application npm run dev
.
You are now able to open application in the browse: http://localhost:3000/
TailwindCSS
Let's stop server and continue the configuration.
Create configuration files
Next, generate your tailwind.config.js
and postcss.config.js
files:
Include Tailwind in your CSS
TailwindCSS is installed in application.
To include them you need to create CSS file:
Now you need to use the @tailwind
directive to include Tailwind's base
, components
, and utilities
styles.
Finally, ensure that CSS file is being imported in your ./src/App.tsx
file:
Application configuration are finished.
Now when you run npm run dev
, Tailwind CSS will be ready to use in your application.
If you want you can check the whole code in this repository.