Skip to content

Commit ea0d1ba

Browse files
authored
feat(material/core): deprecate the core mixin (angular#29906)
1 parent a670949 commit ea0d1ba

File tree

19 files changed

+1
-84
lines changed

19 files changed

+1
-84
lines changed

guides/material-2.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,6 @@ custom theme with Sass, or by importing a pre-built theme CSS file.
108108
A **theme file** is a Sass file that calls Angular Material Sass mixins to output color,
109109
typography, and density CSS styles.
110110

111-
#### The `core` mixin
112-
113-
Angular Material defines a mixin named `core` that includes prerequisite styles for common
114-
features used by multiple components, such as ripples. The `core` mixin must be included exactly
115-
once for your application, even if you define multiple themes. Including the `core` mixin multiple
116-
times will result in duplicate CSS in your application.
117-
118-
```scss
119-
@use '@angular/material' as mat;
120-
121-
@include mat.core();
122-
```
123-
124111
#### Defining a theme
125112

126113
Angular Material represents a theme as a Sass map that contains your color, typography, and density
@@ -190,8 +177,6 @@ theme Sass mixins.
190177
```scss
191178
@use '@angular/material' as mat;
192179

193-
@include mat.core();
194-
195180
$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
196181
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
197182

@@ -225,8 +210,6 @@ uses every single component, this will produce unnecessary CSS.
225210
```scss
226211
@use '@angular/material' as mat;
227212

228-
@include mat.core();
229-
230213
$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
231214
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
232215

@@ -337,8 +320,6 @@ CSS rule declaration. See the [documentation for Sass mixins][sass-mixins] for f
337320
```scss
338321
@use '@angular/material' as mat;
339322

340-
@include mat.core();
341-
342323
// Define a dark theme
343324
$dark-theme: mat.m2-define-dark-theme((
344325
color: (
@@ -470,7 +451,6 @@ the custom theme API.
470451
```scss
471452
@use '@angular/material' as mat;
472453

473-
@include mat.core();
474454
@include mat.strong-focus-indicators();
475455

476456
$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
@@ -502,7 +482,6 @@ of the custom theme API.
502482
```scss
503483
@use '@angular/material' as mat;
504484

505-
@include mat.core();
506485
@include mat.strong-focus-indicators((
507486
border-style: dotted,
508487
border-width: 4px,
@@ -812,8 +791,6 @@ defining multiple themes](#defining-multiple-themes).
812791
```scss
813792
@use '@angular/material' as mat;
814793

815-
@include mat.core();
816-
817794
$my-primary: mat.m2-define-palette(mat.$indigo-palette, 500);
818795
$my-accent: mat.m2-define-palette(mat.$pink-palette, A200, A100, A400);
819796
$my-typography: mat.m2-define-typography-config();
@@ -1064,8 +1041,6 @@ the other theme mixins in your application.
10641041
@use '@angular/material' as mat;
10651042
@use './path/to/carousel-theme' as carousel;
10661043

1067-
@include mat.core();
1068-
10691044
$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
10701045
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
10711046

guides/theming-your-components.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ the other theme mixins in your application.
229229
@use '@angular/material' as mat;
230230
@use './path/to/carousel-theme' as carousel;
231231

232-
@include mat.core();
233-
234232
$my-theme: mat.define-theme((
235233
color: (
236234
theme-type: light,

guides/theming.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ familiarity with CSS and Sass basics, including variables, functions, and mixins
2828
A **theme file** is a Sass file that calls Angular Material Sass mixins to output color,
2929
typography, and density CSS styles.
3030

31-
#### The `core` mixin
32-
33-
Angular Material defines a mixin named `core` that includes prerequisite styles for common
34-
features used by multiple components, such as ripples. The `core` mixin must be included exactly
35-
once for your application, even if you define multiple themes. Including the `core` mixin multiple
36-
times will result in duplicate CSS in your application.
37-
38-
```scss
39-
@use '@angular/material' as mat;
40-
41-
@include mat.core();
42-
```
43-
4431
#### Defining a theme
4532

4633
Angular Material represents a theme as a Sass map that contains your color, typography, and density
@@ -218,8 +205,6 @@ theme Sass mixins.
218205
```scss
219206
@use '@angular/material' as mat;
220207

221-
@include mat.core();
222-
223208
$my-theme: mat.define-theme((
224209
color: (
225210
theme-type: light,
@@ -250,8 +235,6 @@ uses every single component, this will produce unnecessary CSS.
250235
```scss
251236
@use '@angular/material' as mat;
252237

253-
@include mat.core();
254-
255238
$my-theme: mat.define-theme((
256239
color: (
257240
theme-type: light,
@@ -335,8 +318,6 @@ CSS rule declaration. See the [documentation for Sass mixins][sass-mixins] for f
335318
```scss
336319
@use '@angular/material' as mat;
337320

338-
@include mat.core();
339-
340321
// Define a dark theme
341322
$dark-theme: mat.define-theme((
342323
color: (
@@ -500,7 +481,6 @@ the custom theme API.
500481
```scss
501482
@use '@angular/material' as mat;
502483

503-
@include mat.core();
504484
@include mat.strong-focus-indicators();
505485

506486
$my-theme: mat.define-theme((
@@ -531,7 +511,6 @@ of the custom theme API.
531511
```scss
532512
@use '@angular/material' as mat;
533513

534-
@include mat.core();
535514
@include mat.strong-focus-indicators((
536515
border-style: dotted,
537516
border-width: 4px,

integration/yarn-pnp-compat/src/styles.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ $theme: mat.m2-define-light-theme((
88
density: 0
99
));
1010

11-
@include mat.core();
12-
1311
@include mat.all-component-themes($theme);
1412

1513
html,

src/dev-app/theme-m3.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ $light-theme: create-theme($type: light);
3030
// Create our dark theme.
3131
$dark-theme: create-theme($type: dark);
3232

33-
// Include the common styles for Angular Material. We include this here so that you only
34-
// have to load a single css file for Angular Material in your app.
35-
// **Be sure that you only ever include this mixin once!**
36-
@include mat.core();
37-
3833
// Include the default theme styles.
3934
html {
4035
body:not(.demo-experimental-theme) {

src/dev-app/theme.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ $candy-app-theme: mat.m2-define-light-theme((
2121
density: 0,
2222
));
2323

24-
// Include the common styles for Angular Material. We include this here so that you only
25-
// have to load a single css file for Angular Material in your app.
26-
// **Be sure that you only ever include this mixin once!**
27-
@include mat.core();
2824
@include mat.app-background();
2925
@include mat.elevation-classes();
3026

src/e2e-app/theme.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@use '@angular/material' as mat;
22

3-
@include mat.core();
4-
53
$theme: mat.define-theme((
64
color: (
75
theme-type: light,

src/material/core/_core.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@use './tokens/token-utils';
33
@use './style/elevation';
44

5-
// Mixin that renders all of the core styles that are not theme-dependent.
5+
/// @deprecated This mixin is a no-op and is going to be removed in v21.
66
@mixin core() {}
77

88
// Emits the mat-app-background CSS class. This predefined class sets the

src/material/core/theming/prebuilt/azure-blue.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
@use '../../core';
66
@use '../../typography/typography';
77

8-
@include core.core();
98
@include core.app-background();
109
@include core.elevation-classes();
1110

src/material/core/theming/prebuilt/cyan-orange.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
@use '../../core';
66
@use '../../typography/typography';
77

8-
@include core.core();
98
@include core.app-background();
109
@include core.elevation-classes();
1110

0 commit comments

Comments
 (0)