Skip to content

Commit

Permalink
Prevent unquoting on grid elements (#1085)
Browse files Browse the repository at this point in the history
* Prevent unquoting on grid elements

Add "grid" element to list of elements ignored by removeQuotes.
This prevents required quotes from being removed from single column grids.

* Update optimize.js
  • Loading branch information
veleek authored and jakubpawlowicz committed Jan 25, 2020
1 parent 31379cd commit 9b1ed5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/optimizer/level-1/optimize.js
Expand Up @@ -341,7 +341,7 @@ function optimizeZeroUnits(name, value) {
}

function removeQuotes(name, value) {
if (name == 'content' || name.indexOf('font-variation-settings') > -1 || name.indexOf('font-feature-settings') > -1 || name.indexOf('grid-') > -1) {
if (name == 'content' || name.indexOf('font-variation-settings') > -1 || name.indexOf('font-feature-settings') > -1 || name == 'grid' || name.indexOf('grid-') > -1) {
return value;
}

Expand Down
4 changes: 4 additions & 0 deletions test/optimizer/level-1/optimize-test.js
Expand Up @@ -1229,6 +1229,10 @@ vows.describe('level 1 optimizations')
'.block{-webkit-font-feature-settings:"scmp","swsh" 2}',
'.block{-webkit-font-feature-settings:"scmp","swsh" 2}'
],
'grid': [
'.block{grid:"header" 20% "nav" auto/auto}',
'.block{grid:"header" 20% "nav" auto/auto}'
],
'grid-template': [
'.block{grid-template:"header" 20% "nav" auto}',
'.block{grid-template:"header" 20% "nav" auto}'
Expand Down

0 comments on commit 9b1ed5b

Please sign in to comment.