Skip to content

Commit

Permalink
fix: remove multiple identical rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarljubenovic committed Mar 18, 2017
1 parent a4bfb53 commit ca81d12
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bundle.scss
Expand Up @@ -637,12 +637,12 @@

// Handle the last row as distributed dangling
@if $distribute-dangling and not $dangling-at-beginning {
&:last-child { margin-right: 0; }
// For every possible number of dangling elements:
@for $k from 1 through $n {
// Calculate the new width:
$dangling-width: _get-width($k, $g);
// The last element should have right margin reset to 0:
&:last-child { margin-right: 0; }
// For all dangling elements in this case:
@for $i from 1 through $k {
$inv-i: $k + 1 - $i;
Expand Down
2 changes: 1 addition & 1 deletion src/_fixed-grid.scss
Expand Up @@ -136,12 +136,12 @@

// Handle the last row as distributed dangling
@if $distribute-dangling and not $dangling-at-beginning {
&:last-child { margin-right: 0; }
// For every possible number of dangling elements:
@for $k from 1 through $n {
// Calculate the new width:
$dangling-width: _get-width($k, $g);
// The last element should have right margin reset to 0:
&:last-child { margin-right: 0; }
// For all dangling elements in this case:
@for $i from 1 through $k {
$inv-i: $k + 1 - $i;
Expand Down
9 changes: 0 additions & 9 deletions test/_fixed-grid.spec.scss
Expand Up @@ -99,9 +99,7 @@
> *:nth-last-child(2):nth-child(2n + 1) { margin-bottom: 0 }
> *:nth-last-child(1):nth-child(2n + 2) { margin-bottom: 0 }
> *:last-child { margin-right: 0 }
// TODO This is generated twice
> *:nth-last-child(1):nth-child(2n + 1) { width: calc((100% - 0em) / 1) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(2):nth-child(2n + 1) { width: calc((100% - 1em) / 2) }
> *:nth-last-child(1):nth-child(2n + 2) { width: calc((100% - 1em) / 2) }
}
Expand All @@ -123,12 +121,9 @@
> *:nth-last-child(2):nth-child(3n + 2) { margin-bottom: 0 }
> *:nth-last-child(1):nth-child(3n + 3) { margin-bottom: 0 }
> *:last-child { margin-right: 0 }
// TODO This is generated thrice
> *:nth-last-child(1):nth-child(3n + 1) { width: calc((100% - 0em) / 1) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(2):nth-child(3n + 1) { width: calc((100% - 1em) / 2) }
> *:nth-last-child(1):nth-child(3n + 2) { width: calc((100% - 1em) / 2) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(3):nth-child(3n + 1) { width: calc((100% - 2em) / 3) }
> *:nth-last-child(2):nth-child(3n + 2) { width: calc((100% - 2em) / 3) }
> *:nth-last-child(1):nth-child(3n + 3) { width: calc((100% - 2em) / 3) }
Expand All @@ -155,16 +150,12 @@
> *:nth-last-child(2):nth-child(4n + 3) { margin-bottom: 0 }
> *:nth-last-child(1):nth-child(4n + 4) { margin-bottom: 0 }
> *:last-child { margin-right: 0 }
// TODO this is generated four...ice
> *:nth-last-child(1):nth-child(4n + 1) { width: calc((100% - 0em) / 1) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(2):nth-child(4n + 1) { width: calc((100% - 1em) / 2) }
> *:nth-last-child(1):nth-child(4n + 2) { width: calc((100% - 1em) / 2) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(3):nth-child(4n + 1) { width: calc((100% - 2em) / 3) }
> *:nth-last-child(2):nth-child(4n + 2) { width: calc((100% - 2em) / 3) }
> *:nth-last-child(1):nth-child(4n + 3) { width: calc((100% - 2em) / 3) }
> *:last-child { margin-right: 0 }
> *:nth-last-child(4):nth-child(4n + 1) { width: calc((100% - 3em) / 4) }
> *:nth-last-child(3):nth-child(4n + 2) { width: calc((100% - 3em) / 4) }
> *:nth-last-child(2):nth-child(4n + 3) { width: calc((100% - 3em) / 4) }
Expand Down

0 comments on commit ca81d12

Please sign in to comment.