# `mix phia.undaisy`
[🔗](https://github.com/charlenopires/PhiaUI/blob/v0.1.17/lib/mix/tasks/phia.undaisy.ex#L1)

Removes all DaisyUI references from a Phoenix LiveView project.

Automates DaisyUI cleanup so you can adopt PhiaUI cleanly. Targets
configuration files and reports template files that need manual attention.

## What gets changed automatically

- `assets/package.json` — removes `"daisyui"` from dependencies
- `assets/css/*.css` — removes `@plugin`, `@import`, and `@source` DaisyUI lines
- `assets/tailwind.config.js` — removes `require("daisyui")` and `daisyui:` block

## What requires manual migration

DaisyUI CSS classes in `.heex`/`.ex` template files (e.g., `btn-primary`,
`card-body`, `modal-box`) must be replaced manually. PhiaUI uses function
components — not utility classes — for the same UI primitives:

    <%!-- DaisyUI --%>
    <button class="btn btn-primary">Save</button>

    <%!-- PhiaUI --%>
    <.button variant="default">Save</.button>

This task scans your templates and reports every file that contains
DaisyUI-specific class names so you know exactly what needs updating.

## Usage

    mix phia.undaisy

## Options

    --dry-run   Show planned changes without modifying any files
    --help      Print this message

## After running

1. Remove the DaisyUI package from your assets directory:

       cd assets && npm uninstall daisyui
       # or: bun remove daisyui / yarn remove daisyui / pnpm remove daisyui

2. Set up PhiaUI:

       mix phia.install

3. Migrate any listed template files from DaisyUI classes to PhiaUI components.

# `clean_css`

```elixir
@spec clean_css(String.t()) :: {:changed, String.t()} | {:unchanged, String.t()}
```

Removes DaisyUI `@plugin`, `@import`, and `@source` directives from a CSS string.

Returns `{:changed, new_content}` or `{:unchanged, original}`.

# `clean_package_json`

```elixir
@spec clean_package_json(String.t()) ::
  {:changed, String.t()} | {:unchanged, String.t()}
```

Removes the `"daisyui"` key from a package.json string.

Handles both `"dependencies"` and `"devDependencies"` sections.
Uses `Jason` when available (standard in Phoenix projects) for clean
round-trip encoding; falls back to regex otherwise.

Returns `{:changed, new_content}` or `{:unchanged, original}`.

# `clean_tailwind_config`

```elixir
@spec clean_tailwind_config(String.t()) ::
  {:changed, String.t()} | {:unchanged, String.t()}
```

Removes `require("daisyui")` and the `daisyui:` config block from a
tailwind.config.js string.

Returns `{:changed, new_content}` or `{:unchanged, original}`.

# `find_daisy_classes`

```elixir
@spec find_daisy_classes(String.t()) :: [String.t()]
```

Scans a string for DaisyUI-specific component class names.

Returns the list of matched class identifiers found in `content`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
