Google字体导入不适用于Angular Material生产版本

时间:2019-11-19 05:20:09

标签: angular angular-material angular8

不起作用是指字体不可用,而是使用默认类型。这是我的代码:

@import '~@angular/material/theming';

@import "_variables.scss";

@import url('https://fonts.googleapis.com/css?family=PT+Sans');

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();

// Create the theme object (a Sass map containing all of the palettes).
$tb-theme: mat-light-theme($tb-primary, $tb-accent, $tb-warn);

// Define a custom typography config that overrides the font-family as well as the
// `headlines` and `body-1` levels.
$custom-typography: mat-typography-config(
  $font-family: 'PT Sans, sans-serif',
  $headline: mat-typography-level(32px, 48px, 700),
  $body-1: mat-typography-level(16px, 24px, 500)
);

// Override typography CSS classes (e.g., mat-h1, mat-display-1, mat-typography, etc.).
@include mat-base-typography($custom-typography);

// Override typography for a specific Angular Material components.
@include mat-checkbox-typography($custom-typography);

// Override typography for all Angular Material, including mat-base-typography and all components.
@include angular-material-typography($custom-typography);

1 个答案:

答案 0 :(得分:0)

我不得不将字体导入的位置从主题文件更改为_variables.scss文件。