-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.files
being populated in a bad
order
#1338
Comments
Something like https://github.com/hughsk/path-sort should be used to sort the files array and not use the native |
can you link to the offending line of code so we can discuss? thanks! |
@diosney the current sorting behavior is working as-expected. Unfortunately, Grunt doesn't currently allow for a custom sorting method, but perhaps that could be added in a future version; it seems like a useful addition. Could you be more explicit in how you'd like the sorting behavior to change, using words instead of an example, why you'd like it to change, and why you think it's a bug? The only thing I can infer from your example (and from the Thanks! |
@jonschlinkert @cowboy Thanks for your quick response, I will expand below with both words and examples. The current sorting behavior it seems that use the native // here
// |
'src/applications/hr/admin/organization/settings/settings-controller.js',
'src/applications/hr/hr.js', which are "correctly" sorted using the alphanumeric sorting order explained above since the The issue with this algorithm is that Now, think of my current situation here, I have nearly 300 files that need to be concatenated (the uglify task has this issue too, of course) and for them to work properly I had to manually specify its ordering in the If instead of that, a path-sorting function is used on this cases as you,@cowboy, correctly assumed 😄, this kind of bugs in app code will likely disappear. Only one caveat to this, I do want that the sorting algorithm change for the wildcard patterns like src: [
'src/z.js',
'src/a.js
] since when they are specified is because their specified ordering matters, so I recommend that the path-sorting algorithm is specified only for wildcard file patterns only. I hope this makes sense for you, if not, just tell me I will expand further. Thanks |
@cowboy aside from glob, where else in Grunt might sorting be used on files currently?I didn't think it was, maybe I looked right at the code and missed it...
agreed, it does sound like a nice feature to have. |
@jonschlinkert Thanks for your comment. |
Right now
this.files
is being populated as:and should be like:
This seems to be a minor issue, but when used with plugins like
grunt-contrib-concat
lead to wrong concatenated files, since the code execution order is mangled.The text was updated successfully, but these errors were encountered: