node.js - Attach helpers to Jade when running client side (in browser) -
i have made single page app powered node js (express) mongo db. have used jade templating , have templates rendered in browser. templates render fine except unable workout how add helpers. in particular i18next.
i have set route template/get/ looks this:
var fs = require('fs'); var jade = require('jade'); exports.get = function(req, res){ fs.readfile('views/partials/listing_snippet.jade', {encoding: 'utf-8'}, function (err, data) { if (err) throw err; console.log(data); t = jade.compile(data, {client: true, compiledebug: false}); res.send('var template = {listing_snippet: ' + t.tostring() + '}'); }); }
i include , jades 'runtime.js' scripts @ top of page. template renders fine calling template.listing_snippet({locals: foo});
but can not i18next's helpers work. assume need attach helper somehow... documentation little thin in area.
Comments
Post a Comment