From 0c02fc37ce4228507bfb2f0829aea0f1d5465c76 Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Mon, 6 Apr 2015 14:42:06 -0400 Subject: Add Liquid filter to print objects --- app/node_modules/oktemplate/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/node_modules/oktemplate/index.js') diff --git a/app/node_modules/oktemplate/index.js b/app/node_modules/oktemplate/index.js index 502d2cf..75d7e6f 100644 --- a/app/node_modules/oktemplate/index.js +++ b/app/node_modules/oktemplate/index.js @@ -1,9 +1,25 @@ var fs = require('fs'); var path = require('path'); var glob = require('glob'); +var stringify = require('json-to-html'); var LiquidEngine = require('liquid-node').Engine; var liquid = new LiquidEngine(); +/** + * Add any custom liquid filters here. + */ +liquid.registerFilters({ + + /** + * Return a string formatted version of a JSON object. + * Useful for quick debugging of template data. + */ + stringify: function(obj) { + return '
' + stringify(obj) + '
'; + } + +}); + /** * Manages templates. Only supports Mustache currently/ */ -- cgit v1.2.3-70-g09d2