util.js
function (source, destination, context)
    {
      // To avoid issues with windows use a custom delimiter for file names
      if (destination.indexOf('{{-') !== -1) {
        _.templateSettings.escape = /\{\{-(.*?)\}\}/g;
        destination = _.template(destination, context);
      }

      var content = fs.readFileSync(source, 'utf8').toString();

      var indexContent = _.template(content, context);

      fs.writeFileSync(destination, indexContent, 'utf8');
    }
function (source, destination, context)
    {
      // To avoid issues with windows use a custom delimiter for file names
      if (destination.indexOf('{{-') !== -1) {
        _.templateSettings.escape = /\{\{-(.*?)\}\}/g;
        destination = _.template(destination, context);
      }

      var content = fs.readFileSync(source, 'utf8').toString();

      var indexContent = _.template(content, context);

      fs.writeFileSync(destination, indexContent, 'utf8');
    }
function ( source , destination , context ) { // To avoid issues with windows use a custom delimiter for file names if ( destination . indexOf ( '{{-' ) !== - 1 ) { _ . templateSettings . escape = / \{\{-(.*?)\}\} / g ; destination = _ . template ( destination , context ) ; } var content = fs . readFileSync ( source , 'utf8' ) . toString ( ) ; var indexContent = _ . template ( content , context ) ; fs . writeFileSync ( destination , indexContent , 'utf8' ) ; }
Copy a and apply a lodash template to a file based on a given context.
The filename can include a {{= token }} for template delimiters (windows restriction).
@param source
@param destination
@param context
Copy a and apply a lodash template to a file based on a given context . The filename can include a {{ = token }} for template delimiters ( windows restriction ) .