我正在尝试在我的Angular项目中使用自定义主题。但是它没有按照预期工作,我收到了以下错误:
./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./src/custom_theme.scss
Module not found: Error: Can't resolve '@angular/material/theming' in '/Users/mathiasschrooten/Downloads/skylux-admin/src'
我的 styles.css 文件:
@import "custom_theme.scss"
.mat-tab-label {
flex: 1 1 auto;
}
我的custom_theme.scss文件:
@import '~@angular/material/theming';
@include mat-core();
$candy-app-primary: mat-palette($mat-orange);
$candy-app-accent: mat-palette($mat-orange, A200, A100, A400);
$candy-app-warn: mat-palette($mat-red);
$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-
accent, $candy-app-warn);
@include angular-material-theme($candy-app-theme);
.angular-cli.json
"styles": [
"styles.css",
"custom_theme.scss"
],
提前感谢您!