diff --git a/index.js b/index.js index b8ca7ae..0dd98f9 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,14 @@ var createServer = function (e, opts) { }) index = e.files.indexOf(index) } + else { + var sortedFiles = e.files.map(function (el) { + return el.name + }).sort() + index = e.files.findIndex(function (el) { + return el.name === sortedFiles[index] + }) + } e.files[index].select() server.index = e.files[index]