index.js
function iconStyle (files, useIcons) {
  if (!useIcons) return '';
  var className;
  var i;
  var iconName;
  var list = [];
  var rules = {};
  var selector;
  var selectors = {};
  var style = '';

  for (i = 0; i < files.length; i++) {
    var file = files[i];

    var isDir = '..' == file.name || (file.stat && file.stat.isDirectory());
    var icon = isDir
      ? { className: 'icon-directory', fileName: icons.folder }
      : iconLookup(file.name);
    var iconName = icon.fileName;

    selector = '#files .' + icon.className + ' .name';

    if (!rules[iconName]) {
      rules[iconName] = 'background-image: url(data:image/png;base64,' + load(iconName) + ');'
      selectors[iconName] = [];
      list.push(iconName);
    }

    if (selectors[iconName].indexOf(selector) === -1) {
      selectors[iconName].push(selector);
    }
  }

  for (i = 0; i < list.length; i++) {
    iconName = list[i];
    style += selectors[iconName].join(',\n') + ' {\n  ' + rules[iconName] + '\n}\n';
  }

  return style;
}
function iconStyle (files, useIcons) {
  if (!useIcons) return '';
  var className;
  var i;
  var iconName;
  var list = [];
  var rules = {};
  var selector;
  var selectors = {};
  var style = '';

  for (i = 0; i < files.length; i++) {
    var file = files[i];

    var isDir = '..' == file.name || (file.stat && file.stat.isDirectory());
    var icon = isDir
      ? { className: 'icon-directory', fileName: icons.folder }
      : iconLookup(file.name);
    var iconName = icon.fileName;

    selector = '#files .' + icon.className + ' .name';

    if (!rules[iconName]) {
      rules[iconName] = 'background-image: url(data:image/png;base64,' + load(iconName) + ');'
      selectors[iconName] = [];
      list.push(iconName);
    }

    if (selectors[iconName].indexOf(selector) === -1) {
      selectors[iconName].push(selector);
    }
  }

  for (i = 0; i < list.length; i++) {
    iconName = list[i];
    style += selectors[iconName].join(',\n') + ' {\n  ' + rules[iconName] + '\n}\n';
  }

  return style;
}
function iconStyle ( files , useIcons ) { if ( ! useIcons ) return '' ; var className ; var i ; var iconName ; var list = [ ] ; var rules = { } ; var selector ; var selectors = { } ; var style = '' ; for ( i = 0 ; i < files . length ; i ++ ) { var file = files [ i ] ; var isDir = '..' == file . name || ( file . stat && file . stat . isDirectory ( ) ) ; var icon = isDir ? { className : 'icon-directory' , fileName : icons . folder } : iconLookup ( file . name ) ; var iconName = icon . fileName ; selector = '#files .' + icon . className + ' .name' ; if ( ! rules [ iconName ] ) { rules [ iconName ] = 'background-image: url(data:image/png;base64,' + load ( iconName ) + ');' selectors [ iconName ] = [ ] ; list . push ( iconName ) ; } if ( selectors [ iconName ] . indexOf ( selector ) === - 1 ) { selectors [ iconName ] . push ( selector ) ; } } for ( i = 0 ; i < list . length ; i ++ ) { iconName = list [ i ] ; style += selectors [ iconName ] . join ( ',\n' ) + ' {\n  ' + rules [ iconName ] + '\n}\n' ; } return style ; }
Load icon images, return css string.
Load icon images return css string .