Setup:
A
Gruntfile
with the following task:concat: { build: { files: { 'build/app.js': [ 'src/.js', 'src//.js', '!src/vendors/' ], } }
A lot of angular modules, with its controllers, services, and so on, with a structure like this:
a/ a.js // Module declaration like: angular.module('a',[]) a-controller.ks // Which sets a controller in its root module definition like: angular.module('a').controller()...
Issue:
The task concatenates all the js files it finds in the build
folder to a single app.js
file, and it does this fine, but messes up with the order of files when concatenating.
For instance, it concatenates first the controller file instead of the main folder file containing the module declaration, triggering the following error:
Module xxxx not available!
I suppose the issue lies in the way concat
builds up the files and that is done by the grunt core and specifically the minimatch
library, and the possibility it treats dashes to be first than letters, but I don't know how configure to change that behavior, and even know if that is possible.
Question:
So, the question is: How can I make Grunt/Grunt-concat to process dashed f first than the others in the same folder so the ordering is maintained?
Thanks
Update 1:
After digging more, It seems that it has nothing to do with the ordering inside a folder, but Grunt/Core sending the root files to the end and putting them the leaf ones first.