在开发模式下,存在自定义字体(Raleway),但不会反映在暂存环境中。我将我的应用程序部署到 Heroku。
在application.rb中添加以下命令
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
Run Code Online (Sandbox Code Playgroud)
在 application.bootstrap.scss 中添加了 font-family
@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');
}
Run Code Online (Sandbox Code Playgroud)
字体文件可在my_app/app/assets/fonts目录中找到。
我使用命令创建了 Railsrails new my_app --javascript esbuild --css bootstrap --database postgresql
导轨版本 7