Skip to content

Instantly share code, notes, and snippets.

@totherik
Last active August 29, 2015 13:56
Show Gist options
  • Save totherik/8986166 to your computer and use it in GitHub Desktop.
Save totherik/8986166 to your computer and use it in GitHub Desktop.
Load dust helpers in Node.js without making them global.
var vm = require('vm');
var env, script;
env = { dust: { helpers: {} } };
script = vm.createScript(fs.readFileSync(require.resolve('dustjs-helpers'), { encoding: 'utf8' }));
script.runInNewContext(env);
env.dust.helpers // [object Object] with all the helpers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment