Home > Web Front-end > JS Tutorial > Setup Tailwind in your Vite Project with this one command

Setup Tailwind in your Vite Project with this one command

Barbara Streisand
Release: 2025-01-04 01:32:39
Original
735 people have browsed it

Setup Tailwind in your Vite Project with this one command

Hi guys, setting tailwind in your Vite projects may take two to three steps. 
For example in Vite React,

  • You need to install the tailwind.
  • Generate the config files.
  • Add the template to those files.

But I have created an npm package that sets up Tailwind with a single command in your project. It will install the Tailwind, generate the config file, and add the templates to it automatically.

Installation:

npm install -g lazywind
Copy after login

Install the package globally. 

then run,

lazywind
Copy after login

run this command in your project directory.

Example:

Now let's set up a React Project using Vite

Setup react,

npm create vite@latest client -- --template react

cd client

npm install
Copy after login

After setting up React and installing the dependencies, you can run the project using:

npm run dev
Copy after login

Set up Tailwind with Lazywind

Hope, you installed lazywind globally, Now run lazywind in your project folder, for example, client is the folder in this case.

It will,

  • Install Tailwind CSS
  • Generate the tailwind.config.js and postcss.config.js files
  • Add the necessary templates.

That's it, with just a single command.

Package link: https://www.npmjs.com/package/lazywind

Your Tailwind setup is now complete. Test it out and let me know your feedback - I'd love to hear it!

The above is the detailed content of Setup Tailwind in your Vite Project with this one command. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template