Skip to content

Commit

Permalink
Prevent percent sign removal in flex/-ms-flex (fixes css#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Jan 20, 2020
1 parent cb63229 commit ac4b2ed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/replace/Percentage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ var blacklist = new Set([
'max-width',
'height',
'min-height',
'max-height'
'max-height',

// issue #410: Don’t remove units in flex-basis value for (-ms-)flex shorthand
// issue #362: shouldn't remove unit in -ms-flex since it breaks flex in IE10/11
// issue #200: shouldn't remove unit in flex since it breaks flex in IE10/11
'flex',
'-ms-flex'
]);

module.exports = function compressPercentage(node, item) {
Expand Down
23 changes: 23 additions & 0 deletions test/fixture/compress/issue/410.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.flex {
flex: 1 0 0;
}

.flex-pct {
flex: 1 0 0%;
}

.flex-px {
flex: 1 0 0px;
}

.ms-flex {
-ms-flex: 1 0 0;
}

.ms-flex-pct {
-ms-flex: 1 0 0%;
}

.ms-flex-px {
-ms-flex: 1 0 0px;
}
1 change: 1 addition & 0 deletions test/fixture/compress/issue/410.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.flex{flex:1 0 0}.flex-pct{flex:1 0 0%}.flex-px{flex:1 0 0px}.ms-flex{-ms-flex:1 0 0}.ms-flex-pct{-ms-flex:1 0 0%}.ms-flex-px{-ms-flex:1 0 0px}

0 comments on commit ac4b2ed

Please sign in to comment.