@@ -26,6 +26,10 @@ let env = {
26
26
DEBUG : process . env . DEBUG !== undefined ,
27
27
}
28
28
29
+ function sign ( bigIntValue ) {
30
+ return ( bigIntValue > 0n ) - ( bigIntValue < 0n )
31
+ }
32
+
29
33
// ---
30
34
31
35
// This is used to trigger rebuilds. Just updating the timestamp
@@ -261,9 +265,7 @@ function generateRules(tailwindConfig, candidates, context) {
261
265
}
262
266
263
267
function buildStylesheet ( rules , context ) {
264
- let sortedRules = rules . sort ( ( [ a ] , [ z ] ) => {
265
- return Math . sign ( Number ( a - z ) )
266
- } )
268
+ let sortedRules = rules . sort ( ( [ a ] , [ z ] ) => sign ( a - z ) )
267
269
268
270
let returnValue = {
269
271
components : new Set ( ) ,
@@ -1118,13 +1120,7 @@ module.exports = (pluginOptions = {}) => {
1118
1120
if ( appliedSelector !== apply . parent . selector ) {
1119
1121
siblings . push ( [
1120
1122
sort ,
1121
- toPostCssNode (
1122
- [
1123
- replaceSelector ( apply . parent . selector , selector , applyCandidate ) ,
1124
- rule ,
1125
- ] ,
1126
- context . postCssNodeCache
1127
- ) ,
1123
+ toPostCssNode ( [ appliedSelector , rule ] , context . postCssNodeCache ) ,
1128
1124
] )
1129
1125
continue
1130
1126
}
@@ -1138,7 +1134,7 @@ module.exports = (pluginOptions = {}) => {
1138
1134
}
1139
1135
1140
1136
// Inject the rules, sorted, correctly
1141
- for ( let [ sort , sibling ] of siblings . sort ( ( [ a ] , [ z ] ) => Math . sign ( Number ( z - a ) ) ) ) {
1137
+ for ( let [ sort , sibling ] of siblings . sort ( ( [ a ] , [ z ] ) => sign ( z - a ) ) ) {
1142
1138
// `apply.parent` is refering to the node at `.abc` in: .abc { @apply mt-2 }
1143
1139
apply . parent . after ( sibling )
1144
1140
}
0 commit comments