UNPKG

liquid-node

Version:

Node.js port of Tobias Lütke's Liquid template engine.

40 lines (31 loc) 1.29 kB
// Generated by CoffeeScript 1.10.0 (function() { var IfChanged, Liquid, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Liquid = require("../../liquid"); module.exports = IfChanged = (function(superClass) { extend(IfChanged, superClass); function IfChanged() { return IfChanged.__super__.constructor.apply(this, arguments); } IfChanged.prototype.render = function(context) { return context.stack((function(_this) { return function() { var rendered; rendered = _this.renderAll(_this.nodelist, context); return Promise.resolve(rendered).then(function(output) { output = Liquid.Helpers.toFlatString(output); if (output !== context.registers.ifchanged) { return context.registers.ifchanged = output; } else { return ""; } }); }; })(this)); }; return IfChanged; })(Liquid.Block); }).call(this); //# sourceMappingURL=ifchanged.js.map