#handlebars #template #bracket

bracket

Fast and correct handlebars-compatible template engine

83 releases (8 breaking)

0.9.33 Feb 19, 2021
0.9.31 Dec 24, 2020
0.9.19 Nov 28, 2020

#51 in Template engine

Download history 154/week @ 2020-11-07 320/week @ 2020-11-14 580/week @ 2020-11-21 110/week @ 2020-11-28 298/week @ 2020-12-05 91/week @ 2020-12-12 50/week @ 2020-12-19 11/week @ 2020-12-26 39/week @ 2021-01-02 48/week @ 2021-01-09 34/week @ 2021-01-16 9/week @ 2021-01-23 7/week @ 2021-01-30 102/week @ 2021-02-06 439/week @ 2021-02-13 14/week @ 2021-02-20

598 downloads per month
Used in bracket-fluent

MIT/Apache

265KB
6K SLoC

Bracket

Alternative template engine using handlebars-compatible syntax designed for speed, correctness and excellent error handling.

Inspired by handlebars-rust but the API is incompatible in certain places where we think the design should be different.

Except for partials the library does not take ownership of the underlying template strings it simply references them as string slices so it is the caller's responsibility to store them; as a convenience a Loader can be used to store and load templates from disc.

Features

The default features are batteries included but you can set default-features = false and cherry pick.

  • helpers: Include all helpers.
  • log-helper: Enable the log helper.
  • each-helper: Enable the each helper.
  • with-helper: Enable the with helper.
  • lookup-helper: Enable the lookup helper.
  • json-helper: Enable the json helper.
  • conditional-helper: Enable the if and unless helpers.
  • logical-helper: Enable the and, or and not helpers.
  • comparison-helper: Enable the eq, ne, gt, lt, gte and lte helpers.
  • stream: Enable the stream functions on the registry.
  • fs: Support loading templates from the filesystem.

Lifetimes

  • 'reg The lifetime of the registry; helpers, partials and escape functions.
  • 'source The lifetime of a source template string.
  • 'render The lifetime of a template render.
  • 'call The lifetime of a helper call.

Dependencies

~1.1–1.9MB
~40K SLoC