npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

atlatl

v5.6.1

Published

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

Downloads

67

Readme

Atlatl

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>
<html>
  <head>
    @yield head
  </head>
  <body>
    @section main
      ${ safe(content.content) }
    @
  </body>
</html>
@extends layout.html

@section head
  @call title ('Posts')
@

@section main
  <ul>
    @each content.posts (post)
      <li><a href="${ post.permalink }">${ safe(post.title) } &mdash; ${ post.date }</a></li>
    @
  </ul>
@

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.

Methods

@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.

Inheritance

@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.