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

ejt

v0.3.0

Published

Compiler for JavaScript-based HTML templating language

Readme

EJT

This is a server-side compiler for simple JavaScript-based HTML templating.

Commands

All commands are placed between opening <% and closing %> tags.

Include

When the first word after the opening tag is include, the specified file is included into the compiled output. The path is relative to the template's current folder. The default file extension is html and can be omitted.

Include partial.html inside another HTML file

<% include partial %>

Markdown files are rendered and included.

<% include welcome.md %>

JSON files are parsed as an object.

<% const pages = include('site.json') %>

Here's a twist. If the first word is not one of the reserved commands, everything between the tags is evaluated as JavaScript. In that case, include is a function that returns the file content.

Extend

index.html

<% extend layout %>

<% block header %>
  ..Header content..
<% end %>

..Main content..

layout.html

<header>
  <% content header %>
</header>
<main>
  <% content %>
</main>

Compiled result

<header>
  ..Header content..
</header>
<main>
  ..Main content..
</main>

Variables

Escaped: <%= foo %>

Unescaped: <%- bar %>

Code

Escape code block and wrap in <pre><code>

<% code %>
<h1>Code example</h1>
<% end %>

Optionally add attributes: <% code class="language-markup" %>

Inline JS

The compiler runs on Node.js, so there are some ES6 features supported.

<% const pages = include('site.json') %>

<ul>
  <% for (let path in pages) { %>
    <li>
      <a href="/<%- path %>"><%- pages[path] %></a>
    </li>
  <% } %>
</ul>

Output

The variable Output is a buffer holding the compiled HTML up to that point. It can be used to add content.

['item1', 'item2'].forEach((product) => {
  Output += include(`products/${product}`)
})

Local

The variable Local is passed to every template. It has one default property Local.file, which is the current template path. Local can be used to pass data and functions you want available in other templates.

Use

Command line

$ ejt source [destination]

Compiler (server-side only)

var EJT = require('ejt')
var renderer = new EJT( options )

var result = renderer.compile( src )

Gulp

var ejt = require('ejt/gulp')

gulp.task('html', function() {
  return gulp.src( srcPath )
    .pipe( ejt() )
    .pipe(gulp.dest( destPath ))
})

TODO: Express

var ejt = require('ejt/express');

app.use( ejt );

Credit

This is based on a fork of ECT, with on-going refactoring and changes:

  • Plain JavaScript
  • Default file extension; relative path; filename without quotes
  • Include markdown, etc. via extensions
  • New command: code

I believe the original concept came from John Resig's micro-templating.