Templating on Steroids

If you've ever had to weave together dynamic content with HTML, you know how templating can sometimes feel like an afterthought—a clunky, logic-heavy layer that doesn't quite blend seamlessly with your design. But what if we told you we're now bringing logic-less templating on steroids to streamline your development workflows? That's right—we now support Handlebars!

Why Handlebars?

Handlebars is a clean, efficient templating system known for its ability to separate logic from layout. It brings simplicity and flexibility into dynamic content generation, whether for static sites, server-rendered views, or exporting documents such as PDFs. With its declarative nature, Handlebars allows developers to focus on the "what" rather than the "how", ensuring clean and readable templates.

Key Benefits

  • Logic-less Simplicity: Handlebars enforces a clear separation of concerns, promoting long-term maintainability of your code.
  • Dynamic Content Rendering: Embed values, iterate over data, and even conditionally display blocks of HTML dynamically.
  • Custom Helpers & Partials: Define reusable template logic or extend capabilities using custom helpers—no spaghetti templates here!
  • Support for Internationalization: With built-in tools like partial blocks and helpers, creating multilingual templates (e.g., PDFs, reports) becomes much simpler.

What Does This Mean for You?

With Handlebars integrated into our system, you can now:

  • Create Ergonomic Templates: Define readable and maintainable templates that focus on data-driven rendering.
  • Leverage Built-in and Custom Helpers: Handlebars comes with a handy set of built-in helpers, but we didn’t stop there. We've added custom helpers tailored to real-world scenarios, further extending its capabilities.
  • Export Polished Document Outputs with Ease: If you're building PDFs or reports, you can now use dynamic data outputs with proper layout separation.
  • Iterate Faster on UI Logic: With its declarative syntax, you can simplify working with variables and conditionals in your templates.

Built-in and Custom Helpers

Handlebars packs plenty of flexibility with its built-in helpers, such as:

Common Built-in Helpers

  • {{#if}}: Render content conditionally.
  • {{#unless}}: The inverse of {{#if}}.
  • {{#each}}: Iterate over arrays effortlessly.
  • {{#with}}: Narrow down the context to a specific variable scope.
{{#each users}}
  <p>{{name}}</p>
{{/each}}

But to make your life even easier, we've also added custom helpers to support complex templating needs.

New Custom Helpers

Here are two exciting helpers we've introduced:

1. {{compare}}

Simplify comparisons using operators like >, <, ==, and more.

{{#compare a ">" b}}
  a is greater than b
{{else}}
  a is less than or equal to b
{{/compare}}

2. {{json}}

Render objects as a JSON string—helpful for embedding data into charts or scripts.

<script>
  const data = {{{json chartData}}};
</script>

We will continue enhancing this library in response to your feedback. Need custom helpers? Feel free to request them here.

A Quick Example

Here’s a glimpse into how simple and powerful templating with Handlebars can be:

Template

<div>
  <h1>{{title}}</h1>
  <ul>
    {{#each items}}
      <li>{{this}}</li>
    {{/each}}
  </ul>
</div>

Template Data

{
  "title": "Doczilla with Handlebars!",
  "items": ["Item 1", "Item 2", "Item 3"]
}

Output

<div>
  <h1>Doczilla with Handlebars!</h1>
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
</div>

Ready to Dive In?

We’re excited to see how you use Handlebars to bring your templates to life. Whether it’s dynamic reports, interactive UIs, or internationalized documents, Handlebars can help you build elegant solutions while keeping your templates clean and reusable.

Have suggestions or need custom templating features? Drop us a line—we can’t wait to hear what you'll build!

Get started with Handlebars templating today!