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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gjut

v0.1.4

Published

Experimental HTML aware templating language.

Readme

gjut.js

Ask any old unix beard how much preprocessor code is a dignified amount and they will likely tell you as little as possible. In fact, since C++, no new major programming languange has used a preprocessor and that for good reason.

Except HTML templating that is. For some reason we still gladly suffer 1950's style development tools when we generate HTML. Why is that?

Gjut is a semantic templating language. This means unlike ordinary templating systems like rhtml or velocity, it cares whether you produce proper html.

So far Gjut is merely an experiment to make a point.

Requirements

Usage

Gjut comes with an example command line compiler.

$ ./bin/gjutc example/index.html

Macros

@import

Imports a javascript module.

@import dir.file

Loads dir/file.js

@insert

Inserts an html file.

@insert header.html
Variables

Assuming the module modulename returns

return {
    foobar: 'Hello, world!'
}

the variable @modulename.foobar can be inserted as an element content and will render Hello, world!.

The call to gjut.render_html() also takes an object of local variables from the user. Assuming passing something like

gjut.render_local(template, {'local': 'My local var'}, context)

The variable @local will be replaced.

Element functions

Assuming your module returns:

return {
    func: function(element) {
        element.attributes['id'] = ['syntheticId'];
    }
}

The input

<div @modulename.func()></div>

will render as:

<div id="syntheticId"></div>
@foreach

Assuming your module returns:

return {
  listItem: function listItem(element, i) {
    element.content.push({
      type: 'text',
      content: '=== ' + i + " ==="
    });
  }
  array: ['foo', 'bar', 'baz']
}

and your html contains

<li @foreach(@variables.listItem() in @variables.array)></li>

the output will be

<li>
  === foo ===
</li>
<li>
  === bar ===
</li>
<li>
  === baz ===
</li>

Verification

The structural nature of a compiled template means that verification can be performed on the static template before rendering. In theory dynamic verification after code execution is also possible but at at performance cost. This is not implemented.

Has child
@verify .foo -> .bar

Implies that if there is an element with class foo there must also be somewhere in it tree of subelements an element with class bar. Normal css selectors apply so #foo looks for id="foo" and div means any element div.

Has parent
@verify .foo <- .bar

Means any element with class bar must have in its parent chain an element with class foo.

Exists
@verify exist #canvas

Will fail unless there in the compiled template is an element with id canvas. sub-templates from the use of the @insert macro will also be checked.