【问题标题】:Add Google Fonts to Bootstrap 4 with SASS / Gulp使用 SASS / Gulp 将 Google 字体添加到 Bootstrap 4
【发布时间】:2023-04-10 12:31:01
【问题描述】:

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

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

【问题讨论】:

  • 虽然 question above 不是特定于 sass 和 gulp 的,但您的设置也有一个很好的答案。

标签: bootstrap-4 google-fonts


【解决方案1】:

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

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

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

$font-family-sans-serif: "Dosis", […other fonts…];

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

【讨论】:

    猜你喜欢
    • 2019-09-09
    • 2020-06-04
    • 2017-11-26
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    • 2017-11-29
    • 2013-11-14
    • 1970-01-01
    相关资源
    最近更新 更多