作者:dfpkgih | 来源:互联网 | 2023-08-09 20:33
Fixes the case where you compile the templates on the server into functions, then serve them to the frontend for use.
Example:
On the server:
1 2 3
| var hogan = require('hogan.js');
var tpl = require('fs').readFileSync('./template.mu', 'utf8');
console.log("var template = " + hogan.compile(tpl, {asString : true})); // Save output file as `template.js` |
On the client:
该提问来源于开源项目:twitter/hogan.js
Oh right, well I ended up going with this:
1
| http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js |
, the cut off
on http://twitter.github.com/hogan.js/.
Closing this - the documentation could use a bit of love though.
Thanks!
Matt