How to install Tailwind CSS and daisyUI in a UnoCSS project
This guide uses The community (unofficial) package @ameinhardt/unocss-preset-daisy as UnoCSS preset for daisyUI.
Not all daisyUI components are supported yet, some class names may not work as expected.
See the repo for more information.
Create a new Vite project in the current directory
npm create vite@latest ./ -- --template vanillanpm install unocss daisyui @ameinhardt/unocss-preset-daisyAdd UnoCSS to Vite config
import { defineConfig } from 'vite';
import unocss from "unocss/vite";
export default defineConfig({
plugins: [
unocss()
],
});Create a unocss.config.js file in the root of your project and add the following code:
import { defineConfig } from "unocss";
import presetWind4 from "@unocss/preset-wind4";
import { presetDaisy } from "@ameinhardt/unocss-preset-daisy";
export default defineConfig({
content: {
pipeline: {
include: ["src/**/*.{js,ts}"],
},
},
presets: [presetDaisy(), presetWind4()],
});Add the following code at the top of your src/main.js file:
import "@unocss/reset/tailwind.css";
import "uno.css";Now you can use daisyUI class names!