使用 SASS / Gulp 将 Google 字体添加到 Bootstrap 4

Pet*_*vac 7 bootstrap-4 google-fonts

我尝试使用 SASS / Gulp 在 Bootstrap 4 中实现 Google 字体(Dosis)。说到 SASS,我完全是新手。

我设法_custom.scss通过定义来更改默认颜色$brand-primary,但是当我想通过更改$font-family-sans-serif值对字体执行相同操作时,它不起作用。我重新启动了服务器并将 Google 字体包含在带有link标签的 index.html 中......但我仍然无法让它工作。

dfe*_*enc 8

您可以像这样在_custom.scss的顶部导入所选的 Google 字体。

@import url('https://fonts.googleapis.com/css?family=Dosis');
Run Code Online (Sandbox Code Playgroud)

您可以将“Dosis”定义为字体系列名称,如下所示:

$font-family-sans-serif: "Dosis", […other fonts…];
Run Code Online (Sandbox Code Playgroud)

一旦你的 sass 被编译,这应该可以工作。