Jekyll:在SCSS partial中使用_config.yml中的值

时间:2015-12-15 15:58:18

标签: sass jekyll liquid

在我的Jekyll项目中,我在<?php namespace App\Http\Controllers; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use App\k_p_picnic; use Illuminate\Support\Facades\Request as Request; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; public function fixoption($table){ $gender= k_p_picnic::all(); dd($gender) return view('profile',['jj'=>$gender]); } } ?> 文件中有以下内容:

_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

有没有办法让Liquid处理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..." 文件的值?

1 个答案:

答案 0 :(得分:6)

只有你的main.scss才会被杰基尔解析。

一旦用Liquid解析,它就会传递给sass / scss处理器。因此,任何@imported文件都不会被Liquid解析。