How saadeghi/daisyui works
Purpose and Package Shape
This monorepo produces daisyUI, a Tailwind CSS component-library plugin: authored CSS components, utilities, and named themes are compiled into consumable npm/CDN bundles. It also owns the public documentation/site, interactive playground, and AI-editor skill/plugin distributions.
Primary package entry points are packages/daisyui/index.js for the Tailwind plugin and packages/daisyui/build.js for release artifact generation. Prebuilt distribution adapters live in packages/bundle/daisyui.js and packages/bundle/daisyui-theme.js.
CSS Source Model
The product source is declarative CSS, organized by responsibility:
• Global/base behavior: packages/daisyui/src/base/reset.css, packages/daisyui/src/base/properties.css
• Reusable component class definitions: packages/daisyui/src/components/button.css, packages/daisyui/src/components/modal.css
• Theme token definitions: packages/daisyui/src/themes/light.css, packages/daisyui/src/themes/dark.css
• General-purpose styling utilities: packages/daisyui/src/utilities/join.css, packages/daisyui/src/utilities/typography.css
These files are the primary compatibility boundary: documentation examples, generated bundles, and user Tailwind builds all depend on their class names and CSS custom-property contracts.
Plugin and Theme Runtime
packages/daisyui/index.js exposes the integration consumed by Tailwind CSS. Plugin assembly and user-option handling are separated in packages/daisyui/functions/plugin.js and packages/daisyui/functions/pluginOptionsHandler.js. Theme-specific registration is handled by packages/daisyui/functions/themePlugin.js.
Control flow is Tailwind configuration → daisyUI plugin/options → selected component/theme CSS and generated rules → Tailwind output. This is a Node.js/JavaScript build-time runtime, not a browser component runtime.
Build and Distribution Pipeline
packages/daisyui/build.js orchestrates source-to-package generation. It discovers CSS, compiles/extracts styles, transforms CSS into JavaScript-compatible payloads, and creates package-facing files through modules such as packages/daisyui/functions/compileAndExtractStyles.js, packages/daisyui/functions/generatePlugins.js, and packages/daisyui/functions/createPluginFiles.js.
The pipeline’s output boundary is the published package and the checked-in bundle adapters under packages/bundle/. Changes to source CSS often require regenerated plugin/bundle artifacts rather than isolated edits.
Documentation Application
packages/docs is a SvelteKit application serving documentation, component references, marketing content, store/skills pages, feeds, sitemap, and redirects. Its route root and shell are packages/docs/src/routes/(routes)/+layout.svelte and packages/docs/src/routes/(routes)/+page.svelte; SvelteKit endpoint entry points include packages/docs/src/routes/search.csv/+server.js and packages/docs/src/routes/sitemap.xml/+server.js.
Component documentation is MD(S)VEX route content, e.g. packages/docs/src/routes/(routes)/components/button/+page.md, and should remain synchronized with the CSS source contract.
Docs Content, Rendering, and Server Data
MD(S)VEX configuration and transforms govern markdown rendering, links, headings, embedded components, and syntax highlighting: packages/docs/src/lib/mdsvex/mdsvex.config.js, packages/docs/src/lib/mdsvex/render-component.js, packages/docs/src/lib/mdsvex/highlighting/index.js.
Server-side route loaders consume a content/data layer for catalogs, framework pages, comparisons, skills, store products, and media: packages/docs/src/lib/server/content/catalog.js, packages/docs/src/lib/server/content/componentIndex.js, packages/docs/src/lib/server/content/store.js. This separates filesystem/content interpretation from Svelte route presentation.
Ancillary Delivery Surfaces and Infrastructure
The browser playground exercises generated daisyUI styles across LTR/RTL, themes, prefixing, and demos: packages/playground/build-daisyui.js, packages/playground/src/pages/main.js. packages/tailwind-play-share/index.mjs supports Tailwind Play sharing/preview integration.
AI-oriented documentation is distributed as skills and editor plugins, centered on skills/daisyui/SKILL.md, .claude-plugin/plugin.json, and .codex-plugin/plugin.json. GitHub Actions provide test, release, documentation deployment, and Tailwind Play PR-preview automation: .github/workflows/run-tests.yml, .github/workflows/release-new-version.yml, .github/workflows/deploy-docs.yml.
Main entry points: plugin.js Plugin assembly · build.js Package build · button.css Component CSS · +page.md Component docs
Components 21
CSS Source
Shared class and token contract.
- Base CSS
packages/daisyui/src/base/reset.css - Component CSS · Reusable component class definitions.
packages/daisyui/src/components/button.css - Theme tokens
packages/daisyui/src/themes/light.css - Utility CSS
packages/daisyui/src/utilities/join.css
Plugin & Distribution
Tailwind integration and published artifacts.
- Tailwind configuration
- daisyUI plugin entry
packages/daisyui/index.js - Plugin assembly · Applies user options and registers generated rules.
packages/daisyui/functions/plugin.js - Theme registration
packages/daisyui/functions/themePlugin.js - Tailwind CSS output
- Package build · Orchestrates CSS discovery and package generation.
packages/daisyui/build.js - Style compilation
packages/daisyui/functions/compileAndExtractStyles.js - Plugin file generation
packages/daisyui/functions/generatePlugins.js - Bundle adapter · Checked-in package-facing bundle.
packages/bundle/daisyui.js
Documentation
SvelteKit content and rendering.
- Docs route shell
packages/docs/src/routes/(routes)/+layout.svelte - Component docs · Must track the component CSS contract.
packages/docs/src/routes/(routes)/components/button/+page.md - MD(S)VEX rendering · Transforms markdown, embeds, links, and highlighting.
packages/docs/src/lib/mdsvex/mdsvex.config.js - Docs content data · Provides catalogs, framework pages, skills, and store data.
packages/docs/src/lib/server/content/catalog.js - Search & sitemap endpoints
packages/docs/src/routes/search.csv/+server.js
Delivery Surfaces
- Browser playground · Exercises generated styles, themes, RTL, and prefixes.
packages/playground/src/pages/main.js - AI editor skill
skills/daisyui/SKILL.md - Release workflow
.github/workflows/release-new-version.yml
Connections 24
- Base CSS → Plugin assembly: registered by
- Component CSS → Plugin assembly: selected CSS
- Theme tokens → Theme registration: theme definitions
- Utility CSS → Plugin assembly: selected CSS
- Tailwind configuration → daisyUI plugin entry: loads
- daisyUI plugin entry → Plugin assembly: configures
- Plugin assembly → Theme registration: registers
- Plugin assembly → Tailwind CSS output: generates rules
- Theme registration → Tailwind CSS output: generates theme rules
- Base CSS → Package build: build input
- Component CSS → Package build: build input
- Theme tokens → Package build: build input
- Utility CSS → Package build: build input
- Package build → Style compilation: compiles and extracts
- Style compilation → Plugin file generation: style payloads
- Plugin file generation → Bundle adapter: writes artifacts
- Component CSS → Component docs: class contract
- Component docs → MD(S)VEX rendering: rendered by
- MD(S)VEX rendering → Docs route shell: route content
- Docs content data → Docs route shell: server data
- Docs content data → Search & sitemap endpoints: indexes content
- Bundle adapter → Browser playground: generated styles
- Release workflow → Package build: release generation
- Component docs → AI editor skill: AI guidance source