var templateWriter = require("template-writer")
var templateOptions = {
templateDir:'./templates',
targetDir:'/tmp'
}
var config = {
name: 'index.html',
target:'index.html',
vars: {
title: 'My Page',
content: 'My Content'
}
}
templateWriter(
config,
templateOptions
);
//check file creation
var fs = require('fs');
setTimeout(function(){
fs.readFile('/tmp/index.html',function(err,data){
console.log("Check title");
console.log(data.toString().indexOf(config.vars.title)>0);
console.log("Check content");
console.log(data.toString().indexOf(config.vars.content)>0);
});
},2000)