File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
packages/ember-css-modules Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const path = require ( 'path' ) ;
3
4
const debug = require ( 'debug' ) ( 'ember-css-modules:output-styles-preprocessor' ) ;
4
5
const Concat = require ( 'broccoli-concat' ) ;
5
6
const MergeTrees = require ( 'broccoli-merge-trees' ) ;
@@ -78,6 +79,15 @@ module.exports = class OutputStylesPreprocessor {
78
79
return build . apply ( this , arguments ) ;
79
80
} ;
80
81
82
+ // NOTE: we sort file paths using our unique method and then add them to the header
83
+ // so they maintain order. If we don't broccoli-concat would reoder anyway
84
+ let calculatePatch = concat . calculatePatch ;
85
+ concat . calculatePatch = function ( ) {
86
+ let patch = calculatePatch . apply ( this , arguments ) . sort ( sortPatch ) ;
87
+ this . headerFiles = this . headerFiles . concat ( patch . map ( entry => entry [ 1 ] ) ) ;
88
+ return patch ;
89
+ }
90
+
81
91
return concat ;
82
92
}
83
93
@@ -156,3 +166,21 @@ function makeIndex(a, b) {
156
166
157
167
return index ;
158
168
}
169
+
170
+ function sortPatch ( a , b ) {
171
+ const sortNumber = 0 ;
172
+ const aLevels = path . normalize ( a [ 1 ] ) . split ( path . sep ) . length ;
173
+ const bLevels = path . normalize ( b [ 1 ] ) . split ( path . sep ) . length ;
174
+
175
+ if ( aLevels < bLevels ) {
176
+ return - 1 ;
177
+ } else if ( aLevels > bLevels ) {
178
+ return 1 ;
179
+ } else if ( a < b ) {
180
+ return - 1 ;
181
+ } else if ( a > b ) {
182
+ return 1 ;
183
+ } else {
184
+ return 0 ;
185
+ }
186
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ember-css-modules" ,
3
- "version" : " 2.0.1 " ,
3
+ "version" : " 2.1.0-beta.0 " ,
4
4
"description" : " CSS Modules for ambitious applications" ,
5
5
"scripts" : {
6
6
"build" : " ember build --environment=production" ,
You can’t perform that action at this time.
0 commit comments