79575120

Date: 2025-04-15 12:19:48
Score: 1
Natty:
Report link

To fix the error "Can't find stylesheet to import." when importing Angular Material theming in styles.scss, you need to switch from @import to the new Sass module system using @use.

@use '@angular/material' as mat;

$my-primary: mat.define-palette(mat.$indigo-palette, 500);
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$my-warn: mat.define-palette(mat.$red-palette);

$my-theme: mat.define-light-theme((
  color: (
    primary: $my-primary,
    accent: $my-accent,
    warn: $my-warn,
  ),
  typography: mat.define-typography-config(),
  density: 0,
));

// Include the theme styles
@include mat.all-component-themes($my-theme);

See the docs: 👉 https://v17.material.angular.io/guide/theming

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @import
  • Low reputation (1):
Posted by: Paul Pietzko