Prabir Choudhury
Prabir Choudhury

Reputation: 335

Having trouble with Angular Material, SCSS configuration in my App --

Well,

I am having the following error/warning when trying to launch my angular app.

    ERROR in ./src/styles/styles.scss (./node_modules/@angular-devkit/build- 
    angular/src/angular-cli-files/plugins/raw-css- 
    loader.js!./node_modules/postcss-loader/src?? 
    embedded!./node_modules/sass-loader/lib/loader.js??ref--13- 
    3!./src/styles/styles.scss) 
    Module build failed (from ./node_modules/sass-loader/lib/loader.js): 

    undefined 
    ^ 
    Undefined operation "rem(1.4) * 13". 
    ╷ 
    1788 │ $button-font-size-dense: $body-font-size-base * 13/14 !default; 
    │ ^^^^^^^^^^^^^^^^^^^^^^^^^ 
    ╵ 
    node_modules\angular-material\angular-material.scss 1788:26 @import 
    src\styles\_material.scss 8:9 @import 
    stdin 1:9 root stylesheet 
    in
    E:\REPRIMX\SellcodesProj_MEAN\ProtikAPPX\BaseSideAPP\BaseSideAPP\node_modules\angular-material\angular-material.scss (line 1788, column 26) 

Now, this is my _material.scss.

@font-face { 
font-family: 'Fontil Sans'; 
src: url('../assets/fonts/FontinSans/Fontin_Sans_R.otf') format('opentype'); 
} 

@import '~@angular/material/prebuilt-themes/indigo-pink.css'; 
@import '~@angular/material/theming'; 


$custom-typography: mat-typography-config( 
$font-family: 'Fontil Sans, monospace', 
$headline: mat-typography-level(32px, 48px, 700), 
$body-1: mat-typography-level(16px, 24px, 500) 
); 
@include angular-material-typography($custom-typography);

I have added angular-material and angular/theme to my project through npm. So what? Why is this failing? I am guessing I'd be required to replace the angular/material with angular-material, probably? Is that it or something else is wrong?

Do you need to see my angular.json in order to get more idea? If so, pl let know, I will share.

Please give me some hints on this, stuck!

Upvotes: 1

Views: 1349

Answers (1)

Thierry Falvo
Thierry Falvo

Reputation: 6300

It seems you imported the incorrect package, Angular Material for AngularJS.

node_modules\**angular-material**\angular-material.scss 1788:26 @import...

If that's true, you just have to remove this package.

Add then add @angular/material and @angular/cdk

You can check more details in official docs of Angular Components (new name for Angular Material).

Upvotes: 1

Related Questions