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

l10ns-template

v1.0.0

Published

Grunt task for compiling doT templates

Readme

grunt-dot-compiler Build Status

Compiles doT templates ready for RequireJS

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-dot-compiler

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-dot-compiler');

Example

given the following config and template

config

  dot: {
    dist: {
      options: {
        variable : 'tmpl',
        root     : __dirname + '/app/profiles'
      },
      src  : ['app/**/*.dot'],
      dest : 'app/public/templates/tmpl.js'
    }
  }

Options

  • variable String Variable to store everything
  • root String Root of the project
  • requirejs Boolean Enable RequireJS
  • node Boolean Enable Node

templates

templates/item.dot

<li>
  <a>{{=it.url}}<a>
</li>

will output the following script file

dist/tmpl.js

if( typeof define !== "function" ) {
  define = require( "amdefine" )( module )
}
define(function() {
  var tmpl=tmpl|| {};
  tmpl['item']=function anonymous(it) {
    var out='<li><a href="'+(it.url)+'"></a></li>';return out;
  }
  return tmpl;
});

Partials

You can load partials with the load command

  {{##def.partial1: load('./partial1.part') #}} // Use relative paths
  {{##def.partial2: load('test/example/partial2.part') #}} // Use options.root
  
  <div>
    {{#def.partial1}}
    {{#def.partial2}}
  </div>

New in version 0.5

Have you ever wondered if you can set customize CSS classes in partials without doing it right in a Javascript file, instead doing right on the template?

With version 0.4 you can set in-template-vars. Which means, when you load a partial you can set specific variables right in the template.

Define in-template-vars with the following syntax:

{{$ VARIABLE_NAME:DEFAULT_VALUE }}// ":DEFAULT_VALUE" is optional

For instance, in test.part:


<div class="{{$ some:some-var }}"></div>

Load the partial now in test.dot

{{##def.customPartial: load('./test.part', { some : 'some-css-class'}) #}}

{{#def.customPartial}}

And the output will be:

<div class="some-css-class"></div>

Partials-in-partials

You can now create partials in partials and Grunt-dot-compiler will do the mgic for you.

License

Copyright (c) 2012 Tingan Ho Licensed under the MIT license.