Angular material custom theming Undefined mixin error

Discussão em 'Angular' iniciado por Jeanluca Scaljeri, Maio 5, 2025.

  1. I just created an angular 19 app from scratch. Now, I would like to add angular material, so I did:

    $> npm install @angular/material


    Next, I went to Custom Theming. The first code example on the custom theming page is

    @use '@angular/material' as mat;

    html {
    color-scheme: light dark;
    @include mat.theme((
    color: mat.$violet-palette,
    typography: Roboto,
    density: 0
    ));
    }


    Looks solid, but when I copy-paste it into styles.scss it already breaks

    ✘ [ERROR] Undefined mixin.
    ╷
    5 │ ┌ @include mat.theme((
    6 │ │ color: mat.$violet-palette,
    7 │ │ typography: Roboto,
    8 │ │ density: 0
    9 │ │ ));
    │ └────^
    ╵
    apps/hmy-app/src/styles.scss 5:3 root stylesheet [plugin angular-sass]

    angular:styles/global:styles:1:8:
    1 │ @import 'apps/my-app/src/styles.scss';


    Normally I can extract from the message what is going on, but this code looks fine but still it misses a mixin. What did I miss here?

    Continue reading...

Compartilhe esta Página