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

grunt-dustin

v1.0.0

Published

Grunt task for LinkedIn's Dust fork

Downloads

12

Readme

grunt-dustin

Better templating with LinkedIn's dust fork.

Grunt task

Render options

render

Type: Boolean

This tells the task to render templates.

resolve

Type: String

Passed to the adapter as the resolve option.

preserveWhiteSpace

Type: Boolean

Same as adapter option.

data

Type: String
Example: "test/data/*.json"

Passed to the adapter as the data option.

helpers

Type: String
Example: "test/helpers/*.js"

Register helpers for the render context. Passed to the adapter as the helpers option.

cache

Type: Boolean

Propagates to the adapter cache option.

Compile options

compile

Type: Boolean

This tells the target to compile templates.

resolve

Type: String

Passed to the adapter as the resolve option.

preserveWhiteSpace

Type: Boolean

Same as for rendering.

concat

Type: Boolean

This tells the target to concatenate files into the dest file. See the Grunt task config example for details.

Copy options

copy

Type: String
Example: "test/out/js/"

Copy client side libraries to this folder. If this option is set, rendering and compiling is ignored.

resolve

Type: String
Example: "js/"

The client side script will prefix partial paths with this to load them.

This:

{>"some/partial"/}

will resolve to this template: js/some/partial.js.

helpers

Type: String
Example: "test/helpers/client/*.js"

If set, the client scripts will include these helpers.

Example helper file:

dust.helpers.hello = function ( chunk, context, bodies, params ){
  return chunk.write("hello ")
}

dustinHelpers

Type: Boolean

Include dustin helpers to client side. You can see what helpers are available on the client side in the module dir lib/client/helpers.

dustHelpers

Type: Boolean

Include the dustjs helpers to client side.

Task config

grunt.initConfig({
  dustin: {
    // set global values for path resolution
    options: {
      // this prefixes partial lookup to shorten referencing
      resolve: "test/",
      setup: function( adapter, dust ){
        // whatever you want to do with dust before anything happens,
        // do it here
      }
    },
    copyClientLibs: {
      options: {
        // if the client option is present, every other is ignored
        // and client side libraries are copied to this dir
        copy: "test/out/js/",
        // set path resolution to client template loading
        // templates will attempt to load from this dir
        // example: {>"elements/message"/}
        // will load from template/elements/message.js
        resolve: "template/",
        helpers: "test/helpers/client/*.js",
        dustinHelpers: true,
        dustHelpers: true
      }
    },
    render: {
      options: {
        // this target renders html files
        render: true,
        // Dust removes white space by default. Don't do that now.
        preserveWhiteSpace: true,
        // create a global context from these json files
        // file names will be global properties
        data: "test/data/*.json",
        // execute these js files and let them register helpers
        helpers: "test/helpers/node/*.js",
        // this keeps the cache clear
        cache: false
      },
      expand: true,
      cwd: "test/page",
      src: "*.dust",
      dest: "test/out/",
      ext: ".html"
    },
    compile: {
      options: {
        // this target compiles js files
        compile: true,
        // we don't care about white space in compiled templates
        preserveWhiteSpace: false
      },
      expand: true,
      cwd: "test/",
      src: "elements/*.dust",
      dest: "test/out/template/",
      ext: ".js"
    },
    compileAndConcat: {
      options: {
        preserveWhiteSpace: false,
        compile: true,
        // this one concats compiled files into one
        concat: true
      },
      files: {
        "test/out/template/elements.js": "test/elements/*.dust"
      }
    }
  }
})

Licence

MIT