parliament
parliament

Reputation: 22924

Gulp file ordering not as expected

I have the glob:

'app/scripts/page-*/js/*.js'

How can I get gulp to sort the following 2 files in this order:

page-user.js
page-user-create.js

I need page-xxx.js to always go first. I tried gulp-natural-sort using both ascending and descending order but I still get the same result:

page-user-create.js
page-user.js

Upvotes: 0

Views: 104

Answers (1)

Sven Schoenung
Sven Schoenung

Reputation: 30564

You can try gulp-order instead:

.pipe(order([
  'page-*([^-]).js',
  'page-*-*.js'
]))

This should sort all files with a single - in their file name before those files with two - in their file name.

Upvotes: 2

Related Questions