在我的Jekyll项目中,_config.yml
文件中包含以下内容:
colors: - name: red hex: '#FF0000' - name: yellow hex: '#FFFF00' - name: blue hex: '#0000FF'
在中assets/css/colors.scss
,我要为颜色创建类,如下所示:
{% for color in site.colors %} .{{ color.name }} { color: {{ color.hex }}; } {% endfor %}
我想@import
将colors.scss
文件放入main.scss
,但这样做时出现以下错误:
Error in _assets/css/background-test.scss:6 Invalid CSS after "}": expected selector or at-rule, was "{% for color in..." Liquid Exception: Invalid CSS after "}": expected selector or at-rule, was "{% for color in..." in _includes/head.html, included in _layouts/default.html jekyll 3.0.1 | Error: Invalid CSS after "}": expected selector or at-rule, was "{% for color in..."
有没有办法让Liquid处理来自_config.yml
SCSS部分中文件的值?
Jekyll将仅解析您的main.scss。
一旦用Liquid解析,它将被传递到sass / scss处理器。因此,Liquid不会解析任何@imported文件。