Skip to content

Commit

Permalink
fix: fix the repeated generated css theme classes if there is multipl…
Browse files Browse the repository at this point in the history
…e themes defined (#1784)
  • Loading branch information
simongcc authored and Samuell1 committed Jul 12, 2018
1 parent 4bed8cc commit 2922afa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/theme/all.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$md-theme-name: 'all';
@import "../components/MdApp/theme";
@import "../components/MdAutocomplete/theme";
@import "../components/MdAvatar/theme";
Expand Down
13 changes: 9 additions & 4 deletions src/theme/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}

$md-themes: $theme !global;
$md-theme-name: $name !global;

@include md-base-theme;
}
Expand Down Expand Up @@ -88,8 +89,10 @@
$md-theme-palette: map-merge($md-theme-palette, $palette) !global;
$md-current-theme: $theme !global;

&.md-theme-#{$theme} {
@content;
@if( $theme == $md-theme-name or $md-theme-name == 'all' ) {
&.md-theme-#{$theme} {
@content;
}
}
}
}
Expand All @@ -112,8 +115,10 @@
$md-theme-palette: map-merge($md-theme-palette, $palette) !global;
$md-current-theme: $theme !global;

.md-theme-#{$theme} & {
@content;
@if( $theme == $md-theme-name or $md-theme-name == 'all' ) {
.md-theme-#{$theme} & {
@content;
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/theme/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ $md-themes: ();
$md-current-theme: null;


/**
* Store the newly registered theme name for comparison, used for checking just called md-register-theme's theme name
* ---
* @access private
* @type string
* @group themes
*/

$md-theme-name: null;


/**
* The color contrast values
* ---
Expand Down

0 comments on commit 2922afa

Please sign in to comment.