How to use Tailwind CSS and daisyUI in a Bun dev server
Using Bun 1.2.4+ you can serve HTML and CSS files directly in a dev server. Here’s how to setup daisyUI for it.
Create a new Bun project in the current directory
bun init -y
npm install bun-plugin-tailwind daisyui@beta
Create a bunfig.toml
file at root and add bun-plugin-tailwind as a plugin
[serve.static]
plugins = ["bun-plugin-tailwind"]
Create index.html
at root
<!doctype html>
<html>
<head>
<title>daisyUI</title>
<link rel="stylesheet" href="./style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<button class="btn">daisyUI Button</button>
</body>
</html>
Create style.css
at root, add Tailwind CSS and daisyUI
@import "tailwindcss";
@plugin "daisyui";
bun index.html
Now you can use daisyUI class names!