Skip to content

96368a/unocss-preset-daisy

This branch is 5 commits ahead of kidonng/unocss-preset-daisy:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

bc669c4 · May 7, 2024

History

86 Commits
Mar 31, 2023
Jun 12, 2023
Sep 4, 2022
Mar 31, 2023
Apr 12, 2023
Aug 26, 2022
Jun 28, 2023
Jan 1, 2024
May 7, 2024
May 7, 2024
May 7, 2024
Mar 3, 2023
Aug 26, 2022

Repository files navigation

unocss-preset-daisy

UnoCSS preset for daisyUI

Checkout the demo!

Installation

npm install unocss daisyui unocss-preset-daisy

Usage

Note: @unocss/reset comes with unocss. If you are using pnpm, install it separately unless you enable hoisting.

Vite

import {defineConfig} from 'vite'
import unocss from 'unocss/vite'
import {presetUno} from 'unocss'
import {presetDaisy} from 'unocss-preset-daisy'

export default defineConfig({
	plugins: [
		unocss({
			presets: [presetUno(), presetDaisy()],
		}),
	],
})
import '@unocss/reset/tailwind.css'
import 'uno.css'

Astro

import {defineConfig} from 'astro/config'
import unocss from 'unocss/astro'
import {presetUno} from 'unocss'
import {presetDaisy} from 'unocss-preset-daisy'

export default defineConfig({
	integrations: [
		unocss({
			presets: [presetUno(), presetDaisy()],
			injectReset: true,
		}),
	],
})

Nuxt

To use UnoCSS with Nuxt, @unocss/nuxt must be installed as well.

import {defineNuxtConfig} from 'nuxt/config'
import {presetUno} from 'unocss'
import {presetDaisy} from 'unocss-preset-daisy'

export default defineNuxtConfig({
	modules: ['@unocss/nuxt'],
	css: ['@unocss/reset/tailwind.css'],
	unocss: {
		presets: [presetUno(), presetDaisy()],
	},
})

Config

This preset accepts the same config as daisyUI (except for logs and prefix).

{
	presets: [
		presetUno(),
		presetDaisy({
			styled: false,
			themes: ['light', 'dark'],
		}),
	],
}

Limitations

This is not a full daisyUI port. All daisyUI components/utilities should work but they may not work with some UnoCSS features:

Unused styles may be imported. This is both due to lots of hacks being used and how UnoCSS works. However, the preset will try to figure out the minimum styles needed, thus the cost is trivial most of the time.

About

UnoCSS preset for daisyUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%