Socket
Socket
Sign inDemoInstall

dust-usecontent-helper

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

dust-usecontent-helper

A dust helper to load i18n content at render time


Version published
Maintainers
1
Weekly downloads
210
increased by6.6%

Weekly downloads

Readme

Source

dust-usecontent-helper

A dustjs helper to load content bundles into the context for use by the @message helper or the formatjs message helper.

Lead Maintainer: Aria Stewart

Build Status

Example use

var dustjs = require('dustjs-linkedin');
var helper = require('dustjs-usecontent-helper');
var messagehelper = require('dustjs-message-helper');
helper(function (context, bundleName, cb) {
    if (bundleName == 'test.properties') {
        cb(null, {hello: "world"});
    } else {
        cb(new Error("not found"));
    }
}).registerWith(dustjs);
messagehelper.registerWith(dustjs);

dustjs.render('sometemplate', {}, function (err, result) {
    console.log(err, result);
});

And a template like this

{@useContent bundle="test.properties"}
    {@message key="hello" /}
{/useContent}

should return the string "world"

Keywords

FAQs

Last updated on 10 Jul 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc