Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


5.6.1 • Public • Published


Atlatl is a templating language for Node. It is inspired by Jinja and Laravel's Blade.

It could be thought of as a superset of ES6 template strings that adds object oriented features, logic, and default escaping of html.

It looks like this.

@partial title (title)
  <title>${ title }</title>
<!doctype html>
    @yield head
    @section main
      ${ safe(content.content) }
@extends layout.html
@section head
  @call title ('Posts')
@section main
    @each content.posts (post)
      <li><a href="${ post.permalink }">${ safe(post.title) } &mdash; ${ }</a></li>

Lines that begin with an @ are called directives. Some directives are one line. Others are blocks and must be closed with a line with just an @.

HTML output by ES6 templates' ${ ... } is escaped by default but the safe function can be used to mark code to not escape.

The Directives

Logic and Loops

@each var (val, [key])

Loops through an array. Block level.

@if (condition)

Just like any other if statement. Block level.


@partial name ([arg1, [ ...argN]])

Defines a method that can be called with @call. Block level.

@call name ([arg1, [ ...argN]])

Calls a method. If it is not defined an error will occur.

@section name

Defines and calls a method that can be overridden when the template is extended. Block level.

@yield name

Defines and calls a method. A placeholder. Great for templates that are meant to be extended.


@extends template

Used to extend another template. The methods (sections and partials) in the extending template override methods in the extended template and any output outside of methods is ignored.

@import name template [method]

Can import partials or sections (any method) from another file. Use method to rename the method being imported. If method is not set then the name as defined is used.

@parent [name] ([arg1, [ ...argN]])

In a template that extends another template it calls an overridden method. If name is not defined it calls the same method in which it appears.

The Result

Each template is transformed into a CommonJS module that exports a class.




npm i atlatl

Downloadsweekly downloads








last publish


  • avatar