Plates is the templating library in flatiron. Plates binds
data to markup. It's Javascript, Markup and JSON. It works in the browser and
in node.js. All templates are actually valid HTML, with no special characters
for value insertion. The relationship between tags and values is defined
through object literals that are passed to Plates.bind:
You have to install plates before using it
Plates can be used in the program by requiring it.
var http = require('http'),
plates = require(../lib/plates');
var server = http.createServer(function
(req, res) {
res.writeHead(200);
var userSpan = '<span
id="spFirstName">Prajeesh</span> <span
id="spLastName">Prathap</span>'
var userHtml = '<div
id="pnlLogin"></div>';
var map = plates.Map();
map.where('id').is('spFirstName').use('value').as('Prajeesh');
var content
= plates.bind(userHtml, { 'pnlLogin':
userSpan });
res.end(content)
});
server.listen(8083);
No comments:
Post a Comment