I wonder what's the best way to search for template files that has the format *.tmpl.* like comment.tmpl.dotin Node and take the content of the file and execute it as a parameter in a callback?
My basic plan would be
Here is some code to get you started, and here is the filesystem API in NodeJs http://nodejs.org/api/fs.html
var fs = require('fs'),
sourcePath = '/your path/';
var files = fs.readdirSync(sourcePath);
for (var f in files){
var file = files[f];
if (file.match(/.*\.tmpl\..*/) {
// do whatever you want e.g. read the file
fs.readFile(file, function (err, data) {
if (err) throw err;
console.log(data);
});
}
}