【发布时间】:2018-05-27 03:40:24
【问题描述】:
我正在尝试在我的 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'
我的 style.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"
],
提前致谢!
【问题讨论】:
-
@MathijsSegers 我执行了 'npm install --save @angular/material @angular/cdk' 和 'npm install --save @angular/animations'。还有什么我应该导入的吗?根据应该全部的文档,对吗?
标签: angular sass angular-material2