Skip to content

Commit

Permalink
fix(layout): remove some duplicate layout > flex styles (angular#11613)
Browse files Browse the repository at this point in the history
<!-- 
Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed.
-->
## PR Checklist
Please check that your PR fulfills the following requirements:
- [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format)
- [ ] Tests for the changes have been added or this is not a bug fix / enhancement
- [x] Docs have been added, updated, or were not required

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:
```

## What is the current behavior?
Some styles like `.layout-row > .flex-50` are duplicated in the final CSS output.
<!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. -->
Issue Number: 
Fixes angular#11609

## What is the new behavior?
- removed some duplicate layout > flex styles
- reduced unminified CSS size by 5KB

## Does this PR introduce a breaking change?
```
[ ] Yes
[x] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. -->

## Other information
  • Loading branch information
Splaktar authored and mmalerba committed Feb 1, 2019
1 parent b3b8d21 commit 6515e6c
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/core/style/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@

@mixin flex-properties-for-name($name: null) {
$flexName: 'flex';
// $name would be something like xs, sm, md, lg, xl
@if $name != null {
$flexName: 'flex-#{$name}';
$name : '-#{$name}';
Expand Down Expand Up @@ -149,24 +150,26 @@
box-sizing: border-box;
}

.layout#{$name}-row > .#{$flexName}-#{$i * 5} {
flex: 1 1 100%;
max-width: #{$value};
max-height: 100%;
box-sizing: border-box;

// Required by Chrome M48+ due to http://crbug.com/546034
@if $i == 0 { min-width: 0; }
}

.layout#{$name}-column > .#{$flexName}-#{$i * 5} {
flex: 1 1 100%;
max-width: 100%;
max-height: #{$value};
box-sizing: border-box;

// Required by Chrome M48+ due to http://crbug.com/546034
@if $i == 0 { min-height: 0; }
@if ($name != '') {
.layout#{$name}-row > .#{$flexName}-#{$i * 5} {
flex: 1 1 100%;
max-width: #{$value};
max-height: 100%;
box-sizing: border-box;

// Required by Chrome M48+ due to http://crbug.com/546034
@if $i == 0 { min-width: 0; }
}

.layout#{$name}-column > .#{$flexName}-#{$i * 5} {
flex: 1 1 100%;
max-width: 100%;
max-height: #{$value};
box-sizing: border-box;

// Required by Chrome M48+ due to http://crbug.com/546034
@if $i == 0 { min-height: 0; }
}
}
}

Expand All @@ -190,7 +193,7 @@
> .#{$flexName}-66 { flex: 1 1 100%; max-width: 66.66%; max-height: 100%; box-sizing: border-box; }

// Required by Chrome M48+ due to http://crbug.com/546034
> .flex { min-width: 0; }
> .flex { min-width: 0; }
}

.layout#{$name}-column {
Expand Down

0 comments on commit 6515e6c

Please sign in to comment.