util.js
function (source, destination, context, opts)
    {
      if (!opts) opts = {force: true};
      this.mkdirP(destination);

      var files = fs.readdirSync(source);

      for (var i = 0; i < files.length; i++) {
        var sourceFile = path.join(source, files[i]);
        var destinationFile = path.join(destination, files[i]);

        if (this.isDirectory(sourceFile)) {
          this.templateDirSync(sourceFile, destinationFile, context, opts);
        } else {
          if (fs.existsSync(destinationFile) && !opts.force) {
            console.log('skipping existing file: ' + files[i]);
          } else {
            this.templateFileSync(sourceFile, destinationFile, context);
          }
        }
      }
    }
function (source, destination, context, opts)
    {
      if (!opts) opts = {force: true};
      this.mkdirP(destination);

      var files = fs.readdirSync(source);

      for (var i = 0; i < files.length; i++) {
        var sourceFile = path.join(source, files[i]);
        var destinationFile = path.join(destination, files[i]);

        if (this.isDirectory(sourceFile)) {
          this.templateDirSync(sourceFile, destinationFile, context, opts);
        } else {
          if (fs.existsSync(destinationFile) && !opts.force) {
            console.log('skipping existing file: ' + files[i]);
          } else {
            this.templateFileSync(sourceFile, destinationFile, context);
          }
        }
      }
    }
function ( source , destination , context , opts ) { if ( ! opts ) opts = { force : true } ; this . mkdirP ( destination ) ; var files = fs . readdirSync ( source ) ; for ( var i = 0 ; i < files . length ; i ++ ) { var sourceFile = path . join ( source , files [ i ] ) ; var destinationFile = path . join ( destination , files [ i ] ) ; if ( this . isDirectory ( sourceFile ) ) { this . templateDirSync ( sourceFile , destinationFile , context , opts ) ; } else { if ( fs . existsSync ( destinationFile ) && ! opts . force ) { console . log ( 'skipping existing file: ' + files [ i ] ) ; } else { this . templateFileSync ( sourceFile , destinationFile , context ) ; } } } }
Recursively copy a template folder to a given destination and
apply a template context object for using <%= token %> delimiters
and {{= token }} for filename delimiters (windows restriction).

@param source
@param destination
@param context
@param opts
Recursively copy a template folder to a given destination and apply a template context object for using <% = token % > delimiters and {{ = token }} for filename delimiters ( windows restriction ) .