mix mishka.ui.gen.kit (Mishka Chelekom v0.0.9)

Copy Markdown View Source

Vendor the Mishka Chelekom Kit engine into your app (no runtime dependency)

The Kit (customize/from Spark DSL) is not a copied component — it's a live macro whose wrappers call MishkaChelekom.Kit.Runtime at render time and whose use runs Spark transformers at compile time. So, unlike generated components, it can't ride along on a only: :dev, runtime: false install of mishka_chelekom: the engine has to exist in every build that compiles or runs your app, prod included.

This task vendors the engine into your app under your own namespace (default <App>.Kit), so it becomes your code with no mishka_chelekom dependency at compile or run time:

  • the 10 engine modules are copied and namespace-rewritten MishkaChelekom.Kit<App>.Kit;
  • the catalog (used only for compile-time "did you mean?" validation) is regenerated as a self-contained snapshot of the current component names — it no longer reads mishka_chelekom's priv/, so a prod build with no chelekom dep still compiles;
  • {:spark, "~> 2.7"} — the only real dependency the engine needs — is added to mix.exs for you via Igniter (Igniter.Project.Deps.add_dep/3); you never edit mix.exs by hand;
  • a starter <App>.Kit.Customizations module is scaffolded inside the kit folder (skipped if it already exists), where you write your customize blocks.

Everything lands under one folder — lib/<app>/kit/ — the vendored engine and your customizations together.

After this the task has already added spark; the only manual edit is flipping mishka_chelekom to a dev-only generator, leaving mix.exs like:

{:mishka_chelekom, "~> 0.0.9", only: :dev, runtime: false},   # you flip this to dev-only
{:spark, "~> 2.7"}                                            # added for you by this task

and write your customizations against the vendored engine:

defmodule MyApp.Kit.Customizations do
  use MyApp.Kit                       # the vendored engine, not MishkaChelekom.Kit

  components MyAppWeb.Components       # where your components live

  customize :button do
    color :brand, "bg-brand-500! text-white!"
    default color: :brand
  end
end

Re-run the task any time to refresh the vendored engine and the catalog snapshot after adding components.

Example

mix mishka.ui.gen.kit

Options

  • --module or -m - Base module for the vendored engine (default <App>.Kit)
  • --no-deps - Do not add {:spark, "~> 2.7"} to mix.exs
  • --no-starter - Do not scaffold the <App>.Kit.Customizations starter module
  • --yes - Apply without prompts

Summary

Functions

igniter(igniter)

Callback implementation for Igniter.Mix.Task.igniter/1.