# `MishkaChelekom.SimpleCSSUtilities`
[🔗](https://github.com/mishka-group/mishka_chelekom/blob/v0.0.9/lib/mishka_chelekom/simple_css_utilities.ex#L1)

Pure Elixir CSS parser for handling imports and CSS manipulation.
Supports Tailwind CSS 4.x directives and import management.

# `add_import`

Adds a CSS import to the content if it doesn't already exist.

## Examples

    iex> MishkaChelekom.SimpleCSSUtilities.add_import("@import \"tailwindcss\";", "../vendor/mishka.css")
    {:ok, :added, "@import \"tailwindcss\";\n@import \"../vendor/mishka.css\";\n"}

    iex> content = "@import \"../vendor/mishka.css\";"
    iex> MishkaChelekom.SimpleCSSUtilities.add_import(content, "../vendor/mishka.css")
    {:ok, :exists, "@import \"../vendor/mishka.css\";"}

# `add_import_and_theme`

Adds import and theme to CSS content.
Returns the updated CSS content with the import statement and theme.

## Examples

    iex> css_content = "@import 'tailwindcss';"
    iex> theme_content = "@theme { --color-primary: blue; }"
    iex> {:ok, updated} = MishkaChelekom.SimpleCSSUtilities.add_import_and_theme(css_content, "../vendor/mishka.css", theme_content)
    {:ok, "@import 'tailwindcss';
@import "../vendor/mishka.css";

@theme { --color-primary: blue; }
"}

# `ensure_theme_exists`

Ensures theme content exists in the CSS.
If @theme already exists, it replaces it. Otherwise, appends it.

## Examples

    iex> css_content = "@import 'tailwindcss';"
    iex> theme_content = "@theme { --color-primary: blue; }"
    iex> MishkaChelekom.SimpleCSSUtilities.ensure_theme_exists(css_content, theme_content)
    "@import 'tailwindcss';

@theme { --color-primary: blue; }
"

# `import_already_exists?`

Checks if a specific import already exists in the CSS content.
Handles various import formats including Tailwind 4 syntax.

# `insert_import`

Inserts an import statement at the appropriate location in CSS content.
Respects Tailwind 4 directive ordering.

# `read_theme_content`

Reads theme content from a file path.
Returns {:ok, content} or {:error, reason}.

## Examples

    iex> MishkaChelekom.SimpleCSSUtilities.read_theme_content("path/to/theme.css")
    {:ok, "@theme { --color-primary: blue; }"}

# `validate_tailwind_structure`

Validates CSS content for proper Tailwind 4 structure.

---

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