docs: function consolidateFiles (files, config) {
    return Promise.resolve(files)
      .then(files => {
        var data = {};
  
        files.forEach(file => {
          var path = file.relative.split('.').shift().split(Path.sep);
  
          if (path.length >= 2 && config.flattenIndex) {
            var relPath = path.splice(-2, 2);
            path = (relPath[0] === relPath[1] || relPath[1] === 'index')
              ? path.concat(relPath[0])
              : path.concat(relPath);
          }
  
          data[path.join('.')] = JSON.parse(file.contents.toString());
        });
  
        data = sort(data);
  
        const tree = expand(data);
        const json = JSON.stringify(tree);
  
        return Promise.resolve(new Vinyl({
          base: '/',
          cwd: '/',
          path: '/' + (config.name || 'content.json'),
          contents: new Buffer(json)
        }));
      });
  }