UNPKG

templates

Version:

System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.

26 lines (20 loc) 608 B
'use strict'; var utils = require('../utils'); /** * This plugin is used by collections and the main application * instance to ensure that certain methods and settings will * always exist on views. */ module.exports = function decorateView(app, view, options) { if (!utils.isValid(view, 'templates-plugins-view', ['view', 'item'])) { return; } utils.define(view, 'compile', function() { app.compile.bind(app, this).apply(app, arguments); return this; }); utils.define(view, 'render', function() { app.render.bind(app, this).apply(app, arguments); return this; }); };