gulp-sort
Sort files in stream by path or any custom sort comparator
Install
$ npm install gulp-sort --save-dev
Usage
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 ;
Options
gulp-sort
takes in an optional comparator function, or dictionary with following params:
asc
Sort ascending. Defaults to true. Specify false to sort descending.
comparator
Comparator function to use. comparator(file1, file2)
. Defaults to localeCompare
of file paths.
customSortFn
Use customSortFn
in order to control the sorting yourself (useful for stable sorts).
customSortFn
signature is as follows:
customSortFn(<files>, <comparator>)
files
being the vinyl file objects that were passed incomparator
is 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.
License
MIT ©Gilad Peleg