tasks/html_generator.js
function expand(file, root){
    var items = file.orig.src;
    var category = file.dest;
    _debug("Expanding "+category+": ",items,"\n");
    var expanded;
    switch(category){
      case 'meta': //bypass expanding that would break
        expanded = items;
        break;
      case 'head':
      case 'body':
        //expand + retrieve file content
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        expanded = expanded.map(function(item){
          var filePath = path.join(root,item);
          if(isFile(filePath)){
            return grunt.file.read(filePath,{encoding:'utf8'});
          }
          else{
            _debug("File ",filePath," does not exist");
            return item;
          }
        });
        break;
      default:
        //expand
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        break;
    }
    
    _debug("Expanded "+category+": ",expanded,"\n");
    return expanded;
  }
function expand(file, root){
    var items = file.orig.src;
    var category = file.dest;
    _debug("Expanding "+category+": ",items,"\n");
    var expanded;
    switch(category){
      case 'meta': //bypass expanding that would break
        expanded = items;
        break;
      case 'head':
      case 'body':
        //expand + retrieve file content
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        expanded = expanded.map(function(item){
          var filePath = path.join(root,item);
          if(isFile(filePath)){
            return grunt.file.read(filePath,{encoding:'utf8'});
          }
          else{
            _debug("File ",filePath," does not exist");
            return item;
          }
        });
        break;
      default:
        //expand
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        break;
    }
    
    _debug("Expanded "+category+": ",expanded,"\n");
    return expanded;
  }
function expand ( file , root ) { var items = file . orig . src ; var category = file . dest ; _debug ( "Expanding " + category + ": " , items , "\n" ) ; var expanded ; switch ( category ) { case 'meta' : //bypass expanding that would break expanded = items ; break ; case 'head' : case 'body' : //expand + retrieve file content expanded = grunt . file . expand ( { cwd : root , nonull : true } , items ) ; expanded = expanded . map ( function ( item ) { var filePath = path . join ( root , item ) ; if ( isFile ( filePath ) ) { return grunt . file . read ( filePath , { encoding : 'utf8' } ) ; } else { _debug ( "File " , filePath , " does not exist" ) ; return item ; } } ) ; break ; default : //expand expanded = grunt . file . expand ( { cwd : root , nonull : true } , items ) ; break ; } _debug ( "Expanded " + category + ": " , expanded , "\n" ) ; return expanded ; }
Expand file, by converting in an array of strings
@param file Object as returned by task.files
@param root String root directory where paths refer to
@return Array of strings
Expand file by converting in an array of strings