Symfony2中的Sass/Compass

Tho*_*ord 1 css sass symfony

我尝试使用symfony2和asseticbundle的scss文件.

我的config.yml资产部分:

assetic:
debug:          %kernel.debug%
use_controller: false
bundles:        []
filters:
    sass:    ~
    compass: ~
    #closure:
    #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
    #yui_css:
    #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
Run Code Online (Sandbox Code Playgroud)

我的base.html.twig:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>{% block title %}Welcome!{% endblock %}</title>
    {% block stylesheets %}
        {% stylesheets filters="compass"
            "@TestBundle/Resources/public/sass/main.scss"
        %}
        <link rel="stylesheet" href="{{ asset_url }}" />
        {% endstylesheets %}
    {% endblock %}

    <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body ng-app="myapp">
{% block body %}{% endblock %}
{% block javascripts %}
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="{{ asset('js/app.js' ) }}" />
{% endblock %}
Run Code Online (Sandbox Code Playgroud)

我在testBundle/Resources/public/sass/main.scss中的main.scss

$background: #000;

body{
    background-color:$background;
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

Unexpected token "name" of value "filters" in app/Resources/views/base.html.twig at line 7
Run Code Online (Sandbox Code Playgroud)

ant*_*kiy 5

在我的情况下,问题是在过滤器 word中必须过滤.试着改变

{% stylesheets filters="compass"
  "@TestBundle/Resources/public/sass/main.scss"
%}
Run Code Online (Sandbox Code Playgroud)

{% stylesheets filter="compass"
   "@TestBundle/Resources/public/sass/main.scss"
%}
Run Code Online (Sandbox Code Playgroud)