Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function renderVM(template, data) {
const engine = new Engine({template});
const velocityDataPrivate = loadJson('../../velocity.private.data.js');
return engine.render(Object.assign({}, velocityData, velocityDataPrivate, data));
}
}
if(file.isStream()){
return this.emit('error',new Error(PLUGIN_NAME + ": Streaming not supported"));
}
if (file.isBuffer()) {
opt.filePath = file.path;
opt.template = String(file.contents);
try{
var context = getContext(opt);
}catch(err){
return this.emit('error',err)
}
try{
var renderResult = new vEngine(opt).render(context);
}catch(err){
console.log("[gulp-velocity]",colors.red('Error:'),colors.yellow(err.stack));
return this.emit('error',err)
}
file.contents = new Buffer(renderResult);
this.emit('data', file);
}
}
render: function ( context, callback ) {
var renderer = new velocityEngine( {
root: config.templates,
template: tplFile,
cache: false
} );
callback( renderer.render( context ) );
}
},