How to use the velocity.Engine function in velocity

To help you get started, we’ve selected a few velocity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / wix-height-updater / test / mock / vm.ts View on Github external
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));
}
github winnieBear / gulp-velocity / index.js View on Github external
}
    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);
    }
  }
github Lagou-Frontend / idt / common / engines.js View on Github external
render: function ( context, callback ) {
                    var renderer = new velocityEngine( {
                        root: config.templates,
                        template: tplFile,
                        cache: false
                    } );
                    callback( renderer.render( context ) );
                }
            },