谷歌字体未在 Rails 开发中加载,但在生产中运行良好

问题描述

我导入了一种字体并且它在我的机器上工作,因为我安装了字体,我什至没有注意到它不是从 Google Fonts 加载的。它也适用于生产环境,所以在我让我的兄弟打开站点为我测试某些东西之前,它没有被加载到开发中,这没有什么可以提示我的。我尝试了多种不同的方法解决这个问题,但有一些奇怪的行为。这是我的 application.scss 现在的顶部:

/*
 * This is a manifest file that'll be compiled into application.css,which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory,lib/assets/stylesheets,or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * Styles in this file should be added after the last require_* statement.
 *
 * It is generally better to create a new file per style scope.
 *
 *= require font-awesome
 *= require_self
 *= require_tree .
 */

@import "bootstrap/scss/bootstrap";
@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght@200;400;600;900&display=swap');

如果我将我的谷歌字体@import 移动到文件的绝对顶部,甚至在评论之上,它会加载字体,但也会加载 completely breaks a lot of the page styling

当我查看时,我注意到生产和开发 css 之间的差异。 The production css 在 font-awesome 之前使用了 google fonts @import,而 in development 在 font-awesome 之后使用了 @import,所以我尝试删除 font-awesome 并且 google 字体加载完全正常.但是我仍然需要字体很棒,我不能摆脱它。

我知道最简单的解决方案是在布局中使用标签,因为我知道这可行,但我更喜欢使用 css,我认为如果我知道发生了什么会更好。我已经找了一段时间,但我还没有找到任何有类似问题的人。有人知道发生了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)