# @jqhtml/parser

Compiles `.jqhtml` templates into JavaScript for the JQHTML component framework.

```bash
npx jqhtml-compile component.jqhtml -o bundle.js --sourcemap
```

`--sourcemap` embeds the map inline. `--sourcemap=external` writes it to `bundle.js.map`
instead; from the API, `compileTemplate(source, filename, { format, sourcemap: 'external' })`
returns it as `map` alongside `code`.

Templates look like HTML with embedded JavaScript:

```html
<Define:Product_Card class="card">
  <h3><%= this.data.name %></h3>
  <% if (this.data.on_sale) { %>
    <span class="badge">Sale!</span>
  <% } %>
</Define:Product_Card>
```

The parser handles the template syntax - `<Define:>` blocks, `<%= %>` expressions, control flow, slots, event bindings. Output is JavaScript that the `@jqhtml/core` runtime understands.

## Status

Beta release. It compiles production templates daily and the syntax is stable; report any template it mishandles.

Full documentation: **[docs.jqhtml.org](https://docs.jqhtml.org/)**

Found a bug or built something cool? Drop me a line.

---

**hansonxyz** · [hanson.xyz](https://hanson.xyz/) · [github](https://github.com/hansonxyz)
