Jekyll在config.yml中定义字体 [英] Jekyll define fonts in config.yml
本文介绍了Jekyll在config.yml中定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在jekyll模板的_config.yml中定义字体变量,以便可以在CSS中使用Liquid并直接从config更改所有类型的样式.不知何故,这甚至可能吗?
I'm trying to define font variables in my jekyll template's _config.yml so that I can use liquid in my css and change all type styles directy from config. Somehow it's not rendering, is this even possible?
这是我的_config中的内容:
This is what I have in my _config:
fonts:
primary: Roboto Slab
secondary: Helvetica
和CSS:
body {
font-family: '{{ site.fonts.primary }}',{{ site.fonts.secondary }},Arial,sans-serif;
}
推荐答案
您必须提供YAML前题,以使Jekyll处理css文件中的Liquid标签:
You have to provide YAML front matter in order for Jekyll to process Liquid tags in the css file:
---
---
body {
font-family: '{{ site.fonts.primary }}',{{ site.fonts.secondary }},Arial,sans-serif;
}
---
行是YAML前端事项的开始和结束.您无需在其中定义任何内容.
The ---
lines are the start and end of YAML front matter. You do not need to define anything in it.
这篇关于Jekyll在config.yml中定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文