Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mdasifmunshe/2e675ea92d625adf445dc1a7d369eed9 to your computer and use it in GitHub Desktop.
Save mdasifmunshe/2e675ea92d625adf445dc1a7d369eed9 to your computer and use it in GitHub Desktop.
Setting up Tailwind CSS in a Vite app with Yarn
/*
The following gist is tested with react+typescript+swc.
Other Framework may differ from each other at "vite.config.ts" file.
*/
/* Terminal */
yarn create vite my-app
cd my-app
yarn add -D tailwindcss @tailwindcss/vite
/* vite.config.ts */
import { defineConfig } from 'vite'
import react from "@vitejs/plugin-react-swc";
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss()
],
})
/* src/index.css */
@import "tailwindcss";
/* Terminal */
yarn dev
/* Happy Coding */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment