Introduction

Introduction

Jig is a simple, Modern, and batteries included template engine, purpose-built for code generation. Jig is similar to writing JavaScript. If you know JavaScript, you know Jig.

Jig is a fork of Edge, with HTML-specific features stripped out and new capabilities like implicit indentation control and filter syntax added in.

If you already know Edge, just check the differences and you'll know Jig too.

Hello {{ user.username }}!

Hello world

This is a hello world example in Edge.

{{ user.subscription?.plan || 'Not subscribed' }}

JavaScript Expressions

Edge is capable of evaluating any JavaScript expression.

@let(payments = await user.getPayments())
You have made {{ payments.length }} payments so far.

Async/await

You can also make use of async/await keywords within your templates.

@if(user.hasSubscription)
Hurray! You have access to over 280 videos.
@else
Videos are available only to subscribers.
@end

Conditionals

Writing conditionals is similar to JavaScript.

@each(comment in post.comments)
@include('partials/comment')
@end

Loops

You can loop over Arrays and Objects using a unified syntax.

@accordion()
@accordion.item({ title: 'What is Jig?' })
Jig is a template engine for code generation
@end
@accordion.item({ title: 'Why should I use Jig?' })
Because you need a template engine 🤷🏻‍♂️
@end
@accordion.item({ title: 'How can I contribute?' })
By opening issues and PRs on Github
@end
@end

Components

Edge has components as well. They allow re-using markup with an isolated state.

Why another template engine?

Edge has powered AdonisJS for almost seven years and is battle-tested. Jig inherits that foundation and adapts it for code generation — where you need clean, predictable output without HTML baggage.

Differences from Edge

Jig is specifically optimized for code generation, not HTML rendering:

  • No HTML escaping: {{ }} outputs raw values. There's no automatic HTML escaping since you're generating code, not HTML.
  • Implicit indentation control: Block tag content is automatically dedented, and @include re-indents partial output. Clean output without manual whitespace management.
  • Filter syntax: New {{ mode :: expr }} syntax for output transformation. Built-in json filter with extensible registerFilter API.
  • No HTML-specific helpers: Removed html.attrs, html.classNames, nl2br, and other HTML utilities.
  • Same powerful syntax: Inherits Edge's lexer and parser, so you still get .edge file syntax, components, slots, and all the features you know.

Key Features

  • Not restrictive — write any JavaScript expression inside templates.
  • Accurate error stack pointing to the original source file and line.
  • Simple mental model — no custom dialect to learn.
  • Implicit indentation control — block tags automatically strip cosmetic indentation, and include tags re-indent partial output. Template nesting doesn't pollute output formatting.
  • Components layer with support for slots and provide/inject API.
  • Extensible API. 80% of Jig features are implemented using the public API.
  • Filter syntax for custom output transformations.

Why should I use Jig?

If you're building code generators, scaffolding tools, or any system that needs to output structured text (TypeScript, GraphQL schemas, configuration files, etc.), Jig provides a clean template syntax without the overhead of HTML-specific features.

Next steps

Jig is free and open source. If you find it useful, consider supporting its development.

Become a Sponsor