index.js
function moveToDest(srcDir, destDir) {
  if (!this.options.cleanOutput) {
    return srcDir;
  }
  var content, cssDir, src;
  var copiedCache = this.copiedCache || {};
  var copied = {};
  var options = this.options;
  var tree = this.walkDir(srcDir, {cache: this.cache});
  var cache = tree.paths;
  var generated = tree.changed;
  var linkedFiles = [];
  for (var i = 0; i < generated.length; i += 1) {
    file = generated[i];
    if (cache[file].isDirectory || copiedCache[file] === cache[file].statsHash) {
      continue;
    }
    src = srcDir + '/' + file;
    if (file.substr(-4) === '.css') {
      content = fs.readFileSync(src);
      cssDir = path.dirname(file);
      while ((linkedFile = urlRe.exec(content))) {
        linkedFile = (linkedFile[1][0] === '/') ? linkedFile[1].substr(1) : path.normalize(cssDir + '/' + linkedFile[1]);
        linkedFiles.push(linkedFile);
      }
    }
    mkdirp(destDir + '/' + path.dirname(file));
    symlinkOrCopy(src, destDir + '/' + file);
    copied[file] = cache[file].statsHash;
  }

  for (i = 0; i < linkedFiles.length; i += 1) {
    file = linkedFiles[i];
    if (file in copied) { continue; }
    if (!cache[file] || copiedCache[file] !== cache[file].statsHash) {
      copied[file] = cache[file] && cache[file].statsHash;
      mkdirp(destDir + '/' + path.dirname(file));
      symlinkOrCopy(srcDir + '/' + file, destDir + '/' + file);
    }
  }
  this.copiedCache = copied;
  return destDir;
}
function moveToDest(srcDir, destDir) {
  if (!this.options.cleanOutput) {
    return srcDir;
  }
  var content, cssDir, src;
  var copiedCache = this.copiedCache || {};
  var copied = {};
  var options = this.options;
  var tree = this.walkDir(srcDir, {cache: this.cache});
  var cache = tree.paths;
  var generated = tree.changed;
  var linkedFiles = [];
  for (var i = 0; i < generated.length; i += 1) {
    file = generated[i];
    if (cache[file].isDirectory || copiedCache[file] === cache[file].statsHash) {
      continue;
    }
    src = srcDir + '/' + file;
    if (file.substr(-4) === '.css') {
      content = fs.readFileSync(src);
      cssDir = path.dirname(file);
      while ((linkedFile = urlRe.exec(content))) {
        linkedFile = (linkedFile[1][0] === '/') ? linkedFile[1].substr(1) : path.normalize(cssDir + '/' + linkedFile[1]);
        linkedFiles.push(linkedFile);
      }
    }
    mkdirp(destDir + '/' + path.dirname(file));
    symlinkOrCopy(src, destDir + '/' + file);
    copied[file] = cache[file].statsHash;
  }

  for (i = 0; i < linkedFiles.length; i += 1) {
    file = linkedFiles[i];
    if (file in copied) { continue; }
    if (!cache[file] || copiedCache[file] !== cache[file].statsHash) {
      copied[file] = cache[file] && cache[file].statsHash;
      mkdirp(destDir + '/' + path.dirname(file));
      symlinkOrCopy(srcDir + '/' + file, destDir + '/' + file);
    }
  }
  this.copiedCache = copied;
  return destDir;
}
function moveToDest ( srcDir , destDir ) { if ( ! this . options . cleanOutput ) { return srcDir ; } var content , cssDir , src ; var copiedCache = this . copiedCache || { } ; var copied = { } ; var options = this . options ; var tree = this . walkDir ( srcDir , { cache : this . cache } ) ; var cache = tree . paths ; var generated = tree . changed ; var linkedFiles = [ ] ; for ( var i = 0 ; i < generated . length ; i += 1 ) { file = generated [ i ] ; if ( cache [ file ] . isDirectory || copiedCache [ file ] === cache [ file ] . statsHash ) { continue ; } src = srcDir + '/' + file ; if ( file . substr ( - 4 ) === '.css' ) { content = fs . readFileSync ( src ) ; cssDir = path . dirname ( file ) ; while ( ( linkedFile = urlRe . exec ( content ) ) ) { linkedFile = ( linkedFile [ 1 ] [ 0 ] === '/' ) ? linkedFile [ 1 ] . substr ( 1 ) : path . normalize ( cssDir + '/' + linkedFile [ 1 ] ) ; linkedFiles . push ( linkedFile ) ; } } mkdirp ( destDir + '/' + path . dirname ( file ) ) ; symlinkOrCopy ( src , destDir + '/' + file ) ; copied [ file ] = cache [ file ] . statsHash ; } for ( i = 0 ; i < linkedFiles . length ; i += 1 ) { file = linkedFiles [ i ] ; if ( file in copied ) { continue ; } if ( ! cache [ file ] || copiedCache [ file ] !== cache [ file ] . statsHash ) { copied [ file ] = cache [ file ] && cache [ file ] . statsHash ; mkdirp ( destDir + '/' + path . dirname ( file ) ) ; symlinkOrCopy ( srcDir + '/' + file , destDir + '/' + file ) ; } } this . copiedCache = copied ; return destDir ; }
Walks the tree and looks for css files under css directory, if `cleanOutput` is TRUE, css content is read to extract
images and fonts paths to add them to the queue. Note that this function simply return srcDir if `cleanOutput` is false.

@param  {String} srcDir  Source directory
@param  {String} destDir Destination
Walks the tree and looks for css files under css directory if cleanOutput is TRUE css content is read to extract images and fonts paths to add them to the queue . Note that this function simply return srcDir if cleanOutput is false .