@@ -101,15 +101,25 @@ function toShortestColor(m, leading, r1, r2, g1, g2, b1, b2) {
101
101
}
102
102
103
103
// Remove unit from 0 length and 0 percentage if possible
104
- function removeUnitOfZero ( prop , m , leading , num , u , position , value ) {
104
+ function removeUnitOfZero (
105
+ preserveHacks ,
106
+ prop ,
107
+ m ,
108
+ leading ,
109
+ num ,
110
+ u ,
111
+ position ,
112
+ value
113
+ ) {
105
114
if (
106
115
prop === "flex" ||
107
116
prop === "-ms-flex" ||
108
117
prop === "-webkit-flex" ||
109
118
prop === "flex-basis" ||
110
119
prop === "-webkit-flex-basis" ||
111
120
value . indexOf ( "calc(" ) !== - 1 ||
112
- prop . startsWith ( "--" )
121
+ prop . startsWith ( "--" ) ||
122
+ ( preserveHacks && prop === "min-width" && u === "%" )
113
123
) {
114
124
return m ;
115
125
}
@@ -160,7 +170,7 @@ function removeCalcWhiteSpaces(m, leading, calc) {
160
170
}
161
171
162
172
// Wring value of declaration
163
- function wringValue ( prop , value ) {
173
+ function wringValue ( preserveHacks , prop , value ) {
164
174
return value
165
175
. replace ( re . colorFunction , toRGBColor )
166
176
. replace ( re . colorHex , toShortestColor )
@@ -170,7 +180,7 @@ function wringValue(prop, value) {
170
180
. replace ( re . whiteSpacesAfterSymbol , "$1" )
171
181
. replace ( re . whiteSpacesBeforeSymbol , "$1" )
172
182
. replace ( re . numberLeadingZeros , "$1$2" )
173
- . replace ( re . zeroValueUnit , removeUnitOfZero . bind ( null , prop ) )
183
+ . replace ( re . zeroValueUnit , removeUnitOfZero . bind ( null , preserveHacks , prop ) )
174
184
. replace ( re . decimalWithZeros , "$1$2$3.$4" )
175
185
. replace ( re . timeEndsWithZero , toShortestTime )
176
186
. replace ( re . angle , toShortestAngle )
@@ -393,7 +403,7 @@ function wringDecl(preserveHacks, decl) {
393
403
394
404
let values = list . comma ( value ) ;
395
405
396
- value = values . map ( wringValue . bind ( null , prop ) ) . join ( "," ) ;
406
+ value = values . map ( wringValue . bind ( null , preserveHacks , prop ) ) . join ( "," ) ;
397
407
398
408
if ( re . propertyMultipleValues . test ( prop ) ) {
399
409
values = list . space ( value ) ;
0 commit comments