Closed zhekaus closed 8 years ago
When this plugin was released it was common for an AngularJS project to define a module in one file and reuse it in another, i.e:
// module.js:
angular.module('module', ['dep1', 'dep2']);
// module-controller.js
angular.module('module').controller('ModuleController', ...);
If one were to include the two files in the wrong order like this:
<script src="module-controller.js"></script>
<script src="module.js"></script>
Your application would crash. That's what this module is supposed to fix (and have done as far as I know) by reordering them to be:
<script src="module.js"></script>
<script src="module-controller.js"></script>
But if each and every file defines their own modules there is no need for this plugin! Because then a module won't be used before it's been declared.
I am also quite certain that AngularJS was more picky when it came to module load order back in the day, but think it's solved now. So there may be more reasons to not use this plugin today than when it was first released. (I wouldn't know actually because I haven't used AngularJS in quite a while)
Side note: IMO this plugin shouldn't be used at all, use something like Browserify or Webpack instead!
Thanks so much! I've got it.
The thing is I can’t see any issues with AnglarJS caused by source files order. I realized it when I saw that gulp-angular-filesort doesn’t actually sort files in a way I thought.
I’ve thought that gulp-angular-filesort looks at angular.module statements and sort files according to specified dependency in the brackets. It looks like I was wrong, ‘cause it doesn’t.