File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,25 @@ function whenServerReady(cb) {
91
91
100 ) ;
92
92
}
93
93
94
+ function sortModulesFirst ( a , b ) {
95
+ var module = / \. m o d u l e \. j s $ / ;
96
+ var aMod = module . test ( a . path ) ;
97
+ var bMod = module . test ( b . path ) ;
98
+ // inject *.module.js first
99
+ if ( aMod === bMod ) {
100
+ // either both modules or both non-modules, so just sort normally
101
+ if ( a . path < b . path ) {
102
+ return - 1 ;
103
+ }
104
+ if ( a . path > b . path ) {
105
+ return 1 ;
106
+ }
107
+ return 0 ;
108
+ } else {
109
+ return ( aMod ? - 1 : 1 ) ;
110
+ }
111
+ }
112
+
94
113
/********************
95
114
* Reusable pipelines
96
115
********************/
@@ -164,7 +183,7 @@ gulp.task('inject:js', () => {
164
183
return gulp . src ( paths . client . mainView )
165
184
. pipe ( plugins . inject (
166
185
gulp . src ( _ . union ( paths . client . scripts , [ '!client/**/*.spec.<%= scriptExt %>' ] ) , { read : false } )
167
- . pipe ( plugins . sort ( ) ) ,
186
+ . pipe ( plugins . sort ( sortModulesFirst ) ) ,
168
187
{
169
188
starttag : '<!-- injector:js -->' ,
170
189
endtag : '<!-- endinjector -->' ,
You can’t perform that action at this time.
0 commit comments