New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

requirejs-dustjs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requirejs-dustjs

A requirejs plugin for loading and compiling dustjs templates.

latest
Source
npmnpm
Version
1.2.6
Version published
Weekly downloads
10
11.11%
Maintainers
1
Weekly downloads
 
Created
Source

dustjs-require

A requirejs plugin that loads dustjs templates and compiles them. This lets you use dustjs templates in your AMD application like so:

define(
  [
    'dustjs-linkedin',
    'dustc!path/to/my/template/partial.dust'
  ],
  function(dust, tplName){
    dust.render(tplName, {}, function(err, out){
    // do something with your rendered template...
  });
});

Configuration

The dust template file extension is now detected automattically(thanks, @clmsnskr).You must specify the path to this plugin and provide the path to dustjs. You may optionally specify a module name for dustjs if different from "dustjs-linkedin". You must also include the requirejs-text plugin and Q framework in your project:

require.config({
  config: {
    'dustc': {
      dustModule: 'dustjs' // optional, defaults to "dustjs-linkedin"
    }
  },
  paths: {
    'dustc': 'path/to/this/plugin/dustjs-require',
    'dustjs': 'path/to/dustjs-linkedin/dist/dust-full-2.2.2',
    'q': 'path/to/q',
    'text': 'path/to/text'
  }
});

Usage

Include your dustjs templates in your AMD module like you would with the text! plugin:

define(['dustc!path/to/your/template/partial.dust'])

The plugin will load the template, compile it, store it in dust.cache as:

dust.cache['path/to/your/template/partial']

, and return the template name to your AMD module. Then you can easily render your templates via dust.render:

define(
  [
    'dustjs-linkedin',
    'dust!path/to/my/template/partial.dust'
  ],
  function(dust, tplName){
    dust.render(tplName, {}, function(err, out){
      // do something with your rendered template...
    });
  });

This plugin will also work with the r.js optimizer(!).

FAQs

Package last updated on 11 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts