Sha256: 36700552b527cc44aad40169dc728fbace6e9af758016ee1fad3df52b8b5d8ef
Contents?: true
Size: 1.15 KB
Versions: 19
Compression:
Stored size: 1.15 KB
Contents
/** * class EjsEngine * * Engine for the EJS compiler. You will need `ejs` Node module installed * in order to use [[Mincer]] with `*.ejs` files: * * npm install ejs * * This is a mixed-type engine that can be used as a 'backend' of [[JstEngine]] * as well as standalone 'middleware' processor in a pipeline. * * * ##### SUBCLASS OF * * [[Template]] **/ 'use strict'; // 3rd-party var ejs; // initialized later // internal var Template = require('../template'); //////////////////////////////////////////////////////////////////////////////// // Class constructor var EjsEngine = module.exports = function EjsEngine() { Template.apply(this, arguments); ejs = ejs || Template.libs.ejs || require('ejs'); }; require('util').inherits(EjsEngine, Template); // Render data EjsEngine.prototype.evaluate = function (context, locals) { if (this.nextProcessor && 'JstEngine' === this.nextProcessor.name) { return ejs.compile(this.data, { filename: context.logicalPath, client: true }).toString(); } return ejs.render(this.data, { filename: context.pathname, scope: context, locals: locals }); };
Version data entries
19 entries across 19 versions & 1 rubygems