我使用 Angular Material 6 创建了一个自定义主题。当我在 styles.css 中导入主题时,出现错误:
./src/styles.css (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css) 模块构建失败:错误:无法解析'@angular 'C:\Users\D3L1ghT\Documents\PROJECTS\social-network\techhub\src' 中的 /material/theming'
这是我的 my-theme.scss 代码:
@import "~@angular/material/theming";
@include mat-core();
$my-theme-primary: mat-palette($mat-custom-blue, 400);
$my-theme-accent: mat-palette($mat-custom-blue, A100, A100, A400);
$my-theme: mat-light-theme($my-theme-primary, $my-theme-accent);
$primary-color: map_get($my-theme-primary, 400);
$secondary-color: map_get($my-theme-accent, 500);
@include angular-material-theme($my-theme);
这是styles.css的代码:
/* @import "~@angular/material/prebuilt-themes/indigo-pink.css"; */
@import url("./my-theme.scss");
这是 angular.json 的截图:angular.json