将Google字体添加到Rails应用程序

阿加莎

我正在尝试将Google字体添加到我的Rails 5.2应用程序中,但无法弄清楚为什么它不起作用/缺少了什么:

我在application.scss文件中添加了以下几行:

@import url('://fonts.googleapis.com/css?family=Lato:400,700,900&display=swap');

body {
  padding-top: 70px;
  font-family: 'Lato', sans-serif;
}

在application.scss中使用@import之前,我试图在application.html.erb中添加以下行

<link href="https://fonts.googleapis.com/css?family=Lato:400,700,900&display=swap" rel="stylesheet">

谢谢你的帮助!

埃克雷姆卡拉卡

似乎在application.scss的第一行中,有一个冒号(before //fonts,after url(')会导致错误。删除它可以解决此问题:

@import url('//fonts.googleapis.com/css?family=Lato:400,700,900&display=swap');

body {
  padding-top: 70px;
  font-family: 'Lato', sans-serif;
}

无需在应用程序中添加其他行,因为它将在您的scss文件中进行编译。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将字体文件添加到 Web 应用程序

将Google Chrome添加到默认应用程序

将字体添加到Swing应用程序并包含在包中

将本地json文件添加到Rails应用程序并使用$ .getJSON在本地获取它

将 ruby on rails 添加到现有的 React Native 应用程序

将 Typescript 添加到 Vue + Rails 应用程序 - 导入不再有效?

将刺激和导入映射添加到现有的 Rails 6.1 应用程序

将 jQuery 表编辑插件添加到我的 rails 5 应用程序

如何将 CoreUI 添加到 rails (+ React) 应用程序?

Ruby on Rails:将api添加到现有的Web应用程序

将外部.js文件添加到新的Rails 6 Web应用程序

将jQuery插件添加到我的Rails 4应用程序中

将Cordova插件添加到Mobile Google Chrome应用程序?

将Google Adwords脚本添加到Vaadin应用程序中

如何通过我的应用程序将信用卡添加到Google Pay?

可以将google日历添加到iOS应用程序吗?

使用Google / Facebook帐户将连接添加到JavaEE应用程序

将图像添加到 Google 表格电子邮件应用程序脚本

如何使用font-face将本地字体添加到我的React应用程序

将Autofac添加到WPF MVVM应用程序

如何将主题添加到应用程序?

将非托管应用程序添加到 Chocolatey

将libgdx添加到Android本机应用程序

将 Babel 添加到 Typescript React 应用程序

无法将firebase添加到Android应用程序

将应用程序添加到托管的Django项目

将范围添加到instagram应用程序?

将应用程序添加到Gnome DO

将图块添加到MFC应用程序