How can I change the default font for a Jekyll website

爱⌒轻易说出口 提交于 2020-08-22 19:10:18

问题


I'm new to using Jekyll, css, etc, and I forked the Jekyll now repo. Is there a way I can change, or add, default fonts to the entire jekyll website? It looks like this post may have some answers, but I don't really understand it.


回答1:


Edit the file style.scss located at the root of the jekyll instance, you can change the font from this:

body {
  ...
  font: 18px/1.4 $helvetica;
}

to this:

body {
      font-family: "Times New Roman", Times, serif;
}

or whatever font you want.

If you want to make it better, use variables, add them to _sass/_variables.css

$times: "Times New Roman", sans-serif;

and then change in style.scss:

body {
    font: 18px/1.4 $times;
}



回答2:


check this Font change Jekyll

The answer you mention telling is to edit your _config.yml file by adding the font names. i prefer add your font in sass file.




回答3:


If you want to add a font asset to your project instead of using web-hosted fonts, you can import the font file into the project's assets folder. For the theme I'm using (minimal-mistakes), the correct assets folder is located in ROOT/docs/assets/



来源:https://stackoverflow.com/questions/41551672/how-can-i-change-the-default-font-for-a-jekyll-website

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!