Updates, ideas and resources
It can be annoying to install, setup, config and import all the dependencies. But now, you can do it with a single command.
Setting up Tailwind CSS and PostCSS and then adding daisyUI is not that hard at all, but it can be annoying to do the same process again and again on every project.
Now, you can do all of these with a single command:
npm init daisyui
npm init daisyui
gives you 3 options:
🌼 Initializing daisyUI…
? Do you want to setup Tailwind CSS first?
❯ No need. I already have Tailwind
Yes. Setup Tailwind first
Yes. Setup Tailwind first (with PostCSS)
If it’s a new project of if you didn’t have Tailwind CSS installed, you can choose the second or third option. Otherwise, you can choose the first option and it will skip the Tailwind CSS setup.
If you choose the first option
If you choose the second option
npx tailwindcss init
) with default config@tailwind
directives in itIf you choose the third option
npx tailwindcss init
) with default configYes.
How to initiate Tailwind CSS and daisyUI with Yarn:
yarn create daisyui
How to initiate Tailwind CSS and daisyUI with Bun:
bun create daisyui
You can also use create
alias instead of init
in NPM:
npm create daisyui
It doesn’t setup content
config in tailwind.config.js
file.
You need to do it yourself because it depends on your file structure. You can read more about it in Tailwind CSS docs.
It doesn’t add your CSS file into your HTML. You need to do it yourself because it depends on your build tool or bundler. You may want to import it like this:
import "/output.css"
Or put it in HTML like this:
<link href="/output.css" rel="stylesheet" />
It doesn’t add any scripts in package.json
file to build your CSS file.
If you’re using a bundler, it will be handled automatically. Otherwise you may need to add a script to package.json
file to build your CSS file.
Like this:
npx tailwindcss -i tailwind.css -o output.css
Or this:
npx postcss-cli tailwind.css -o output.css
It’s open source of course and the source code is here: https://github.com/daisyui/create-daisyui/
Let me know if you have any suggestions or feedback.
Subscribe to daisyUI blog newsletter to get updates on new posts.
You will only receive a single email when a new blog post is published. No spam. No ads.