Igniter-facing wrappers: they take and return an Igniter struct, so callers
get Igniter's normal diff preview and confirmation flow for free.
Available only when igniter is a dependency. Without it, every function here
returns {:error, :igniter_not_available}; use IgniterCss directly instead.
Comment ownership on delete
When a codemod removes a declaration or a rule, these comments go with it:
- a comment trailing on the same line;
- a comment on its own line directly above, with no blank line between.
These are kept:
- a comment separated from the target by a blank line;
- a comment that reads as a section header — one spanning several lines, or
containing a rule of three or more repeated
= - * # ~ _characters, e.g./* ===== Layout ===== */.
Example
def install(igniter, _opts) do
igniter
|> IgniterCss.Codemods.ensure_at_rule("assets/css/app.css", ~s|@plugin "daisyui";|)
|> IgniterCss.Codemods.ensure_rule("assets/css/app.css", ".hide-scrollbar")
|> IgniterCss.Codemods.set_declaration(
"assets/css/app.css", ".hide-scrollbar", "scrollbar-width", "none"
)
endEach step is idempotent, so re-running the installer produces no diff.