lib/io.js
function writeTemplateFileSync(source, context, destination) {
  var templateContent = fs.readFileSync(source, 'utf8');
  var templateResult;
  try {
    templateResult = _.template(templateContent, context);
  } catch(error) {
    console.error('templateFileSync() error with source', source, ' and ', destination);
    console.error(error);
  }
  fs.writeFileSync(destination, templateResult);
}
function writeTemplateFileSync(source, context, destination) {
  var templateContent = fs.readFileSync(source, 'utf8');
  var templateResult;
  try {
    templateResult = _.template(templateContent, context);
  } catch(error) {
    console.error('templateFileSync() error with source', source, ' and ', destination);
    console.error(error);
  }
  fs.writeFileSync(destination, templateResult);
}
function writeTemplateFileSync ( source , context , destination ) { var templateContent = fs . readFileSync ( source , 'utf8' ) ; var templateResult ; try { templateResult = _ . template ( templateContent , context ) ; } catch ( error ) { console . error ( 'templateFileSync() error with source' , source , ' and ' , destination ) ; console . error ( error ) ; } fs . writeFileSync ( destination , templateResult ) ; }
Shortcut to read a template file, apply a context and write it to a new file.
//todo refactor template utilities from ../util.js to lib/template.js
@param source
@param context
@param destination
Shortcut to read a template file apply a context and write it to a new file . // todo refactor template utilities from .. / util . js to lib / template . js