簡體   English   中英

使用 heroku / ruby​​ on rails 無法在生產中加載字體

[英]Font doesn't load in production with heroku / ruby on rails

我的自定義字體已在開發中加載,但未在 heroku 上加載,您能幫我弄清楚嗎?

@font-face {
  font-family: "Syne";
  src: asset-url('/assets/Syne-Regular.otf') format("truetype");
}
@font-face {
  font-family: "Syne-Title";
  src: asset-url('/assets/Syne-Extra.otf') format("truetype");
}


$body-font: "Syne";
$headers-font: "Syne-Title";

請在assets文件夾下創建fonts文件夾並將字體文件移動到該文件夾​​中。 並將fonts文件夾添加到資產路徑。

config.assets.path << Rails.root.join('app', 'assets', 'fonts')

只需使用`font-url 定義字體。

@font-face {
  font-family: "Syne";
  src: font-url('Syne-Regular.otf') format("truetype");
}
@font-face {
  font-family: "Syne-Title";
  src: font-url('Syne-Extra.otf') format("truetype");
}


$body-font: "Syne";
$headers-font: "Syne-Title";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM