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

adaro

v1.0.4

Published

An express renderer for DustJs Templates

Downloads

3,874

Readme

adaro

Lead Maintainer: Aria Stewart

Build Status

An expressjs plugin for handling DustJS view rendering. dustjs-helpers are included by default in this module.

var express = require('express');

var app = express();

var adaro = require('adaro');

var options = {
  helpers: [
    //NOTE: function has to take dust as an argument.
    //The following function defines @myHelper helper
    function (dust) { dust.helpers.myHelper = function (a, b, c, d) {} },
    '../my-custom-helpers',   //Relative path to your custom helpers works
    'dustjs-helpers',   //So do installed modules
    {
      name: '../my-custom-helpers/helper-to-render-data-with-args',
      // or use this signature if you need to pass in additional args
      arguments: { "debug": true }
    }
  ]
};

app.engine('dust', adaro.dust(options));
app.set('view engine', 'dust');

// For rendering precompiled templates:
// app.engine('js', adaro.js({ ... ));
// app.set('view engine', 'js');

Make sure that if you've app.set('views', somepath) that the path separators are correct for your operating system.

Configuration

Config options can be used to specify dust helpers, enabled/disable caching, and custom file loading handlers.

helpers (optional) String Array, helper module names

A helper module must either:

  • Conform to the API established by [dustjs-helpers] (https://github.com/linkedin/dustjs-helpers) provided by LinkedIn or
  • Export a function which accepts a single argument (being dust itself). Such files should generally be designed for use on both client and server.

Client and Server Compatible

function setupHelpers(dust) {

   // Add helpers

}

if (typeof exports !== 'undefined') {
    module.exports = setupHelpers;
} else {
    setupHelpers(dust);
}

Alternate API

module.exports = function (dust) {
    // Add helpers
};

cache (optional, defaults to true) Boolean

Set to true to enable dust template caching, or false to disable.

app.engine('dust', dustjs.dust({ cache: false }));
app.set('view engine', 'dust');

helpers (optional) An array of helper modules to require and use.

Expects helpers to be in the form of:

module.exports = function (dust, [options]) {
    dust.helpers.something = function (chunk, context, bodies, params) {
    };
};

Breaking changes

v1.0.0

  • Removed the layout: option to render and in configuration
  • Dust is our own private instance, not global. If you load helpers, you must do it in the configuration of adaro.
  • We outright require dust. We will not use your application's installed version.
  • Dust ~2.7.1 is required. Dust minors are breaking changes, so those affect users of this module too.
  • Paths passed to the engine that are filesystem absolute paths will be used as is, and not resolved against the view root.
  • dustjs-helpers is not loaded for you automatically. Add it to your helpers configuration if you want it. Make sure you use a version compatible with the dustjs-linkedin that adaro uses.