用途\ndaisyui-config 是 daisyUI 5 的配置说明,用于在构建配置中通过 @plugin "daisyui" 指令调整 daisyUI 的行为。官方配置文档地址为 https://daisyui.com/docs/config/。\n\n主要能力\n配置项包括:themes(主题列表,可用 --default 指定默认主题、--prefersdark 指定深色模式主题)、root(根选择器,示例为 ":root")、include(包含项)、exclude(排除项,示例中排除了 rootscrollgutter 与 checkbox)、prefix(类名前缀,示例为 daisy-)、logs(是否输出控制台日志)。\n\n使用方式\n无配置时直接写:\n@plugin "daisyui";\n\n仅启用 light 主题并设为默认:\n@plugin "daisyui" {\n themes: light --default;\n}\n\n使用全部默认设置:\n@plugin "daisyui" {\n themes: light --default, dark --prefersdark;\n root: ":root";\n include: ;\n exclude: ;\n prefix: ;\n logs: true;\n}\n\n完整示例配置启用全部内置主题,bumblebee 为默认主题,synthwave 为 prefersdark 主题(即默认深色模式);要使用其他已启用主题,在 <html> 元素上添加 data-theme="THEME_NAME"。该配置排除了 root scrollbar gutter,为所有 daisyUI 类使用 daisy- 前缀,并关闭控制台日志:\n@plugin "daisyui" {\n themes: light, dark, cupcake, bumblebee --default, emerald, corporate, synthwave --prefersdark, retro, cyberpunk, valentine, halloween, garden, forest, aqua, lofi, pastel, fantasy, wireframe, black, luxury, dracula, cmyk, autumn, business, acid, lemonade, night, coffee, winter, dim, nord, sunset, caramellatte, abyss, silk;\n root: ":root";\n include: ;\n exclude: rootscrollgutter, checkbox;\n prefix: daisy-;\n logs: false;\n}\n\n适用场景\n适用于使用 daisyUI 5 并需要自定义主题集合、默认主题与深色模式主题、类名前缀或日志输出的前端项目。\n\n限制\n资料仅提供上述配置项与示例,未说明各配置项的完整取值规则、版本兼容性、性能影响或其他未列出的选项,这些内容暂未提供。
daisyui-config
前端与建站
更新于 10-16 05:35