Docs
> Vite
Vite
Install and Configure Vite
1
Create a project
Start by creating a new React project using vite
npm create vite@latest
2
Add Tailwind and its configuration
Install tailwindcss and its peer dependencies, then generate your tailwind.config.js and postcss.config.js files:
npm install -D tailwindcss postcss autoprefixer 
npx tailwindcss init -p
                    
Add this import header in your main css file, src/index.css in our case:
@tailwind base;
@tailwind components;
@tailwind utilities;
                    
Configure the tailwind template paths in tailwind.config.js:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{ts,tsx,js,jsx}"],
theme: {
extend: {},
},
plugins: [],
}
                    
3
Edit tsconfig.json file

{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
 }
],
 "compilerOptions": {
 "baseUrl": ".",
 "paths": {
"@/*": ["./src/*"]
 }
 }
}
                    
4
Edit tsconfig.app.json file
{
"compilerOptions": {
// ...
 "baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
}
// ...
}
}
                    
5
Update vite.config.ts
npm i -D @types/node

import path from "path"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
})
                        
6
Run the CLI
npx velour-ui init
7
That's it
npx velour-ui add button
The command above will add the Button component to your project. You can then import it like this:

import { Button } from "@/components/ui/button"
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
)
}
                        
logo
A Marketplace for Designers and Developers

© 2024 Velour UI. All Rights reserved.
Privacy Policy | Terms of Service | Refund Policy