如何将 Google 字体添加到 Drupal 8 主题?
How to add Google fonts to Drupal 8 theme?
将 Google 字体添加到 Drupal 8 主题的正确方法是什么?
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
编辑 THEME.libraries.yml
并将其添加为“外部”类型的常规 CSS 文件:
global-styling:
css:
theme:
https://fonts.googleapis.com/css?family=Lato: { type: external }
替代 Maxim 的答案,您可以通过库添加一个 css 文件,并使用 @import 方法加载您的 Google 字体。
@import url('https://fonts.googleapis.com/css?family=Bungee+Hairline');
将 Google 字体添加到 Drupal 8 主题的正确方法是什么?
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
编辑 THEME.libraries.yml
并将其添加为“外部”类型的常规 CSS 文件:
global-styling:
css:
theme:
https://fonts.googleapis.com/css?family=Lato: { type: external }
替代 Maxim 的答案,您可以通过库添加一个 css 文件,并使用 @import 方法加载您的 Google 字体。
@import url('https://fonts.googleapis.com/css?family=Bungee+Hairline');