Sort files in stream by path or any custom sort comparator
$ npm install gulp-sort --save-dev
var sort = ;// default sortgulp;// pass in a custom comparator functiongulp;// sort descendinggulp;// sort with a custom comparatorgulp;// sort with a custom sort functionvar stable = ;gulp;
gulp-sort takes in an optional comparator function, or dictionary with following params:
Sort ascending. Defaults to true. Specify false to sort descending.
Comparator function to use.
comparator(file1, file2). Defaults to
localeCompare of file paths.
customSortFn in order to control the sorting yourself (useful for stable sorts).
customSortFn signature is as follows:
filesbeing the vinyl file objects that were passed in
comparatoris the default comparator used, or a custom one that was passed as param
This function is expected to return back the sorted list of files.
MIT ©Gilad Peleg