# `mix tessera.from_lit`
[🔗](https://github.com/the-robot-lives/tessera/blob/v0.2.0/lib/mix/tasks/tessera.from_lit.ex#L1)

Converts an existing Lit 3 component (`.js`/`.ts`) into a tessera component
stub in the current Mix project:

    mix tessera.from_lit assets/js/persona-widget.ts
    mix tessera.from_lit src/my-element.ts --out packages/my_element
    mix tessera.from_lit src/my-element.ts --module MyApp.Components.MyElement --tag my-element

Runs `Noizu.Tessera.FromLit.Extractor` (mechanical shape extraction:
reactive properties, events, slots, styles) and then
`Noizu.Tessera.FromLit.Generator`, writing the same file set as
`mix tessera.gen.component`:

  * the spec module (`lib/...`, attr/prop/event/slot/cy DSL from the shape);
  * the colocated `<snake_tag>.mjs` Lit element stub (extracted styles
    carried over, `register` export kept — CONTRACT.md §5);
  * a web-test-runner test skeleton at `test/components/<snake_tag>_test.mjs`.

The output is a STUB, not a transpiled element: everything the contract
grammar cannot represent is reported as a warning (also embedded in the
generated moduledoc). Existing files are never overwritten unless `--force`.

Options:

  * `--out <dir>` — project root to write into (default: cwd);
  * `--module Some.Module` — spec module name (default
    `<AppCamel>.Components.<CamelTag>`);
  * `--tag my-tag` — override the tag when the source has no
    `@customElement`/`customElements.define` (otherwise derived from the
    filename, with a warning);
  * `--force` — overwrite existing files.

Run `mix compile` afterwards to generate the contract module, and
`mix tessera.install` once per host app. See `docs/notes/from-lit.md`.

---

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