在开发模式下,自定义字体 (Raleway) 存在,但不会反映在暂存环境中。我将我的应用程序部署到 Heroku。
在 application.rb 中添加以下命令
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
在 application.bootstrap.scss 中添加了字体系列
@font-face {
font-family: 'raleway-regular';
font-style: normal;
font-weight: 400;
src: font-url('raleway-regular.ttf') format('truetype');
}
@font-face {
font-family: 'raleway-semibold';
src: font-url('raleway-semibold.ttf') format('truetype');
}
@font-face {
font-family: 'raleway-medium';
src: font-url('raleway-Medium.ttf') format('truetype');
}
字体文件在my_app/app/assets/fonts
目录中可用。
我使用命令创建了我的导轨rails new my_app --javascript esbuild --css bootstrap --database postgresql
导轨版本 7