node-conkitty v0.0.3
node-conkitty 
Apply Conkitty templates in Node.JS.
Conkitty is a DOM builder and supposed to
work in browsers. Sometimes it is nice to be able to apply the same templates
on server-side too. node-conkitty utilizes
jsdom for DOM building.
Install npm package:
npm install node-conkittyRun this code (having file1.ctpl and file2.ctpl):
conkitty = require('node-conkitty');
conkitty.compile(['file1.ctpl', 'file2.ctpl']);
console.log(conkitty.applyTemplate('template1', 'Hello', 'World'));
// <div><strong>Hello</strong></div><p><em>World</em></p>Assume file1.ctpl looks like:
template1 $arg1 $arg2
div
CALL template2 $arg1
p
ns::tpl $arg2
template2 $arg
strong
$argAnd file2.ctpl looks like:
ns::tpl $arg
em
$argjsdom is not the fastest solution available, but it gives full W3C DOM
support. My primary goal of using jsdom is to bring the ability to run
Conkitty templates on server-side to build static sites with minimal efforts.
And for static site generator high performance is not a very critical thing.
With more efforts it is possible to run templates much faster and it'll
probably happen some day in future.