# `Braces.SendGrid`
[🔗](https://github.com/dbernheisel/braces/blob/v0.1.0/lib/braces/send_grid.ex#L1)

The helpers of SendGrid's dynamic templates, which are Handlebars: render a SendGrid
template as SendGrid sends it.

    template =
      Braces.Handlebars.compile!(~S|{{#greaterThan (length cart) 0}}{{insert name "default=Customer"}}, | <>
        ~S|you left {{length cart}} items, {{formatDate saved_at "MMMM DD, YYYY h:mm A" "-0800"}}.| <>
        ~S|{{/greaterThan}}|)

    Braces.Handlebars.render!(template, data, helpers: Braces.SendGrid)

- `{{#equals a b}}` and `{{#notEquals a b}}`: `3` equals `"3"`, as SendGrid compares them.
- `{{#greaterThan a b}}` and `{{#lessThan a b}}`.
- `{{#and a b}}` and `{{#or a b}}`, with two or more values. A value is false when it's
  missing, `false`, `""` or `0`.
- `{{length value}}`: a string's length, as JavaScript counts it, or a list's; `0` for
  anything else.
- `{{insert value "default=Customer"}}`: the value, or the default when it's missing or `""`.
- `{{formatDate date "MMMM DD, YYYY"}}`, with an optional UTC offset such as `"-0800"`: a
  `DateTime`, an ISO 8601 string, or milliseconds since 1970, as JavaScript's `Date` reads
  them. Tokens: `YYYY`, `YY`, `MMMM`, `MMM`, `MM`, `M`, `DD`, `D`, `dddd`, `ddd`, `HH`, `H`,
  `hh`, `h`, `mm`, `m`, `ss`, `s`, `A`, `a`, `ZZ` and `Z`.

The block helpers render `{{else}}` when their condition is false. `#if`, `#unless`,
`#each`, `#with`, `@root` and the rest of Handlebars work as in Handlebars.js.

# `and`

# `and`

# `and`

# `equals`

# `formatDate`

# `formatDate`

# `greaterThan`

# `insert`

# `length`

# `lessThan`

# `notEquals`

# `or`

# `or`

# `or`

---

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